masmerise / livewire-toaster

Beautiful toast notifications for Laravel / Livewire.
MIT License
342 stars 22 forks source link

Fix: Prevent error in toast disposal when $el is null #43

Closed faisuc closed 3 months ago

faisuc commented 3 months ago

In dynamic applications using Livewire, where elements in the DOM can be updated or replaced, calling the dispose method on a Toast instance sometimes results in an Uncaught TypeError: Cannot read properties of null (reading 'addEventListener'). This occurs when this.$el is null or undefined, which can happen if the DOM element associated with the Toast has been removed or replaced by Livewire before dispose is called.

mabdullahsari commented 3 months ago

Thank you!