Extra request when notifications are triggered using $wire vs javascript
Does anyone know why notifications sent using a $wire method:
public function successMessage(): void { Notification::make() ->title('Operation Successful') ->success() ->send(); }
public function successMessage(): void { Notification::make() ->title('Operation Successful') ->success() ->send(); }
make 1 more backend request compared to notifications triggered via js:
triggerNotification: function() { new window.FilamentNotification() .title('Operation Successful') .success() .send(); }
triggerNotification: function() { new window.FilamentNotification() .title('Operation Successful') .success() .send(); }
?
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