filament: Notification throws 500 error on admin panel
Package
filament/notifications
Package Version
v2.15.28
Laravel Version
v9.26.1
Livewire Version
v2.10.6
PHP Version
8.1.9
Problem description
In the filament admin panel when I save a new record or save an edited record the page will show me the saved notification for less than a second and after that, this error appears on my screen.
Expected behavior
it must show the notification and not throw an error.
Steps to reproduce
- clone this repo: https://github.com/ariaieboy/filament-notification-bug-example
- copy
.env.example
file to.env
- create an SQLite database and set it on
.env
file - run migration
- create filament user
- login to the admin panel
- try to create or edit a user
Reproduction repository
https://github.com/ariaieboy/filament-notification-bug-example
Relevant log output
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (18 by maintainers)
Can you fix that in your PR then? Please bump the version inside each package
composer.json
, not just the maincomposer.json
I don’t see why we would ever need to use
Js::from()
if we just bump the Livewire version?Seems really weird that this was a patch release in livewire though.
Personally I would do it as Js:from() since v3 is so close and people will have to update their livewire anyway.
Yeah so this issue is caused by
@js
.Recently, a fix was merged into Livewire to use the
@js
directive from Laravel instead of the one provided by Livewire if it’s available in the user’s Laravel version: https://github.com/livewire/livewire/pull/4876.Previously,
@js
wouldn’t work in some places and we had to use{{ Js::from() }}
instead. After that PR got merged, I updated the Filament notifications code to use the Blade directive instead of{{ Js::from() }}
.So anyone who’s using a Livewire version that predates the Livewire bug fix, will run into this Filament notifications issue. Reverting the following inside the notifications package fixes the issue:
@danharrin and @awcodes, do you think we should revert the
@js
change and use{{ Js::from() }}
instead to be sure no one runs into issues like this one? Hard to test all usages of@js
inside Filament and prevent any issues in the future. Personally, I’d say it was a bug in Livewire that has been fixed and users should just make sure to upgrade their Livewire version to include the bug fix.Let me know your thoughts!
Is this really a Livewire issue, wow