emitSelf
I am not able to make ->emitSelf() working from a button within a notification. The event is never trigger. If I use ->emit() it works, but that's not the behaviour I want as I have other livewire components listening to this event on the same page. Any thoughts? Issue already figured out ? Thanks for feedback and help
12 Replies
i dont think emitSelf makes sense in that situation
self is the notifications livewire component
not the page or anything
is there emitTo ?
yes there is. But I thought that emitSelf intends to emit an event within the livewire component context, as this notification is sent from a livewire component. I don't want to propagate the event to the whole page because there are other livewire components with same class listening to the same event
where us your listener registered? i dont think it would work how you want it to
my events are registered in the livewire component emitting the event via a notification
ok but they dont actually emit the event
its a bit confusing
but the filament notifications package uses a separate component to emit it from
which is why you need emitto
I have a livewire component with a button emitting a event. The event emits a Notification as a confirmation. Then the Notification emits an event when the ok button is clicked inside the notification
I am just trying to have a confirmation dialog on a button
This button is not a page or table action, just a html button
yes
i understand
but emitself will not work.
emitUp does not work too
yup
should be emitto
Can I pass the id of the livewire component to the emitTo function ?
as data, yeah
and then check the ID in the listener
For the moment I implemented a workaround using inline alpinejs confirmation
Thanks Dan for your help!