wire-elements / modal

Livewire component that provides you with a modal that supports multiple child modals while maintaining state.
MIT License
1.09k stars 129 forks source link

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

Open phila088 opened 2 months ago

phila088 commented 2 months ago

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.