Extra request when notifications are triggered using $wire vs javascript
Does anyone know why notifications sent using a $wire method:
make 1 more backend request compared to notifications triggered via js:
?
If I use <button @click="triggerNotification()"> there are only 2 requests. One when the button is clicked, one when the toast disappears.
But if use <button @click="$wire.successMessage()" then 2 requests are made in quick succession when the button is clicked. Meaning a total of 3 requests.
Just trying to figure out how things are working under the hood
2 Replies
I'm not sure, but I think in the case of
$wire.successMessage()
, the first request just calls the livewire method, and then the second triggers the notification.@Patrick Boivin Ok that makes sense. Cheers