Database notifications panel stays open after clicking ->url() notification action in spa mode

I recently enabled spa mode on my filament admin panel, where I have noticed that the database notifications panel stays open after navigating to a resource page from a notification url action. Also it seems like the css sometimes (at random it) does some weird stuff causing some elements in the navigation sidebar to flash when clicking the notification action buttons. I have attached a screen recording of the issue. And here is the code for how one of these notifications are created:
$superAdmins = User::role('super_admin')->get();

foreach ($superAdmins as $superAdmin) {
Notification::make()
->title(Lang::get('complaint.admin.title.new_complaint', [
'user' => $complaint->userOrder->user->full_name,
'group' => $complaint->userOrder->group->name
]))
->body(Lang::get('complaint.admin.content.new_complaint', [
'user' => $complaint->userOrder->user->full_name,
'group' => $complaint->userOrder->group->name
]))
->actions([
Action::make('view')
->label(Lang::get('complaint.admin.label.view_complaint'))
->button()
->url(ComplaintResource::getUrl('view', ['record' => $complaint]))
->markAsRead()
])
->broadcast($superAdmin)
->sendToDatabase($superAdmin);
event(new DatabaseNotificationsSent($superAdmin));
}
$superAdmins = User::role('super_admin')->get();

foreach ($superAdmins as $superAdmin) {
Notification::make()
->title(Lang::get('complaint.admin.title.new_complaint', [
'user' => $complaint->userOrder->user->full_name,
'group' => $complaint->userOrder->group->name
]))
->body(Lang::get('complaint.admin.content.new_complaint', [
'user' => $complaint->userOrder->user->full_name,
'group' => $complaint->userOrder->group->name
]))
->actions([
Action::make('view')
->label(Lang::get('complaint.admin.label.view_complaint'))
->button()
->url(ComplaintResource::getUrl('view', ['record' => $complaint]))
->markAsRead()
])
->broadcast($superAdmin)
->sendToDatabase($superAdmin);
event(new DatabaseNotificationsSent($superAdmin));
}
Is this how it is supposed to be, or is this a bug?
Solution:
The bug is spa mode. All it does is set the wire:navigate on links. You would have to explicitly tell every action to close the modal with a live event listener. Long story short spa mode in livewire isn’t solid yet and if you need an actual spa then you need to build one. Otherwise let livewire do what it does. 😅
Jump to solution
2 Replies
Solution
awcodes
awcodes4w ago
The bug is spa mode. All it does is set the wire:navigate on links. You would have to explicitly tell every action to close the modal with a live event listener. Long story short spa mode in livewire isn’t solid yet and if you need an actual spa then you need to build one. Otherwise let livewire do what it does. 😅
nowak
nowakOP4w ago
Alright, I will disable spa mode again then 😄 Thanks!
Want results from more Discord servers?
Add your server