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
Dan Harrin
Dan Harrin2y ago
i dont think emitSelf makes sense in that situation self is the notifications livewire component not the page or anything is there emitTo ?
David Vincent
David VincentOP2y ago
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
Dan Harrin
Dan Harrin2y ago
where us your listener registered? i dont think it would work how you want it to
David Vincent
David VincentOP2y ago
my events are registered in the livewire component emitting the event via a notification
Dan Harrin
Dan Harrin2y ago
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
David Vincent
David VincentOP2y ago
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
Dan Harrin
Dan Harrin2y ago
yes i understand but emitself will not work.
David Vincent
David VincentOP2y ago
emitUp does not work too
Dan Harrin
Dan Harrin2y ago
yup should be emitto
David Vincent
David VincentOP2y ago
Can I pass the id of the livewire component to the emitTo function ?
Dan Harrin
Dan Harrin2y ago
as data, yeah and then check the ID in the listener
David Vincent
David VincentOP2y ago
For the moment I implemented a workaround using inline alpinejs confirmation Thanks Dan for your help!
Want results from more Discord servers?
Add your server