Skip to content

Commit fb0d7f4

Browse files
committed
Replace ineffective session polling with navigate-based refresh
Session-based polling doesn't work because nothing replenishes session data during poll requests. Instead, listen for Livewire's navigated event to re-pull session data after SPA page transitions, which catches banners pushed by the new page's mount lifecycle.
1 parent 64c8930 commit fb0d7f4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

resources/views/livewire/alerts/alert-banner-container.blade.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
<div wire:poll.visible.15s="pullFromSession" id="alert-banner-container" class="flex flex-col gap-4">
1+
<div
2+
x-data
3+
x-init="document.addEventListener('livewire:navigated', () => $wire.pullFromSession())"
4+
id="alert-banner-container"
5+
class="flex flex-col gap-4"
6+
>
27
@foreach ($alertBanners as $alertBanner)
38
{{ $alertBanner }}
49
@endforeach

0 commit comments

Comments
 (0)