Files
filament/packages
9d34b2f29f fix: prevent duplicate notifications when Livewire events are batched (#19649)
* fix: prevent duplicate notifications when Livewire events are batched

Fixes #16662

When a child component fires both a notification and a Livewire event,
the dehydrate hook runs for every component being dehydrated. Previously,
each component checked session()->get() (non-destructive) and dispatched
'notificationsSent', causing duplicate notifications.

This change uses session()->pull() (destructive read) to atomically
claim notifications on first dehydrate, and passes the notification data
directly with the dispatch event. This prevents subsequent component
dehydrations from seeing the same session data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Do not allow notifications to leave the server

* Update Notification.php

Signed-off-by: Dan Harrin <git@danharrin.com>

---------

Signed-off-by: Dan Harrin <git@danharrin.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Dan Harrin <git@danharrin.com>
2026-04-13 10:04:37 +01:00
..
2026-02-17 09:39:16 +00:00