Skip to content

On closeModel(), getting error Livewire\Features\SupportLegacyModels\EloquentModelSynth::setDataOnModel(): Argument #1 ($model) must be of type Illuminate\Database\Eloquent\Model, null given #442

Description

@phila088

When calling $this->closeModal() I am getting the above error. This is called as it is in the documentation, and I cannot locate anything else in the issues regarding this. Not sure where to start.

I am calling function confirmDelete() from a wire:click() on a button in the modal to confirm the delete of a record. The record deletes properly, it runs $this->dispatch() fine, and closes the modal, but then throws the error once closed.

EDIT:

After further testing, it has to do with the events. Any events fired cause the error. If I run $this->dispatch() the error shows after close, but is present on mobile view. If it is fired with $this->closeModalWithEvents() it is displayed after closing the modal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions