-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vertical notification animation broken #7395
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@zepfietje I'm not sure if this is related, if you need to me open a new issue please let me know. We have the following code: $quote->wasRecentlyCreated
? $this->redirectRoute('quotes.edit', $quote->id)
: Notification::make()->title(__('general.saved'))->success()->send();
$this->dispatch('log:fresh'); The event is used to refresh our audit log. The audit log has its own Livewire component. When the notification is sent, it drops down from the top right to the bottom right of the screen. As soon as we remove the dispatch or remove |
Once this issue is fixed, the issue you're experiencing will probably be fixed too, @ju5t. |
@zepfietje I will schedule some time to look into it tomorrow. Can't promise I find a solution though, my JS is a bit rusty. Are there any other places to look for the animation aside from notification.js#L76? |
No worries, @ju5t, any insights are welcome! |
@zepfietje I found something. When we're not dispatching the
When we dispatch our It's related to NotificationsServiceProvider.php#L52. This uses: on('dehydrate', function (Component $component) {
...
}); In our situation, two components are dehydrating at about the same time. The Our component is called if ($component instanceof ActivityLog) {
return;
} This prevents notifications being sent from that component and solved it for us. Obviously this is not a solution, I haven't had the time to think about that yet. And I don't know if this is the cause of other issues with notifications either. Food for thought :) |
I spent some more time on this today, but I can't find a clean solution. What worked for our issue is 'abusing' sessions to see if we've dispatched the event yet. Perhaps someone with more knowledge on the Livewire internals can come up with a cleaner way of doing this. Preferably so we can ditch the dehydrate logic altogether as it's somewhat redundant. Here's our code to try out. In the service provider: if (session()->get('filament.notificationsSent', false) === false) {
$component->dispatch('notificationsSent');
session()->put('filament.notificationsSent', true);
} And inside the session()->forget('filament.notificationsSent'); |
Could you explain better how you did this? |
@mateusgalasso this is not user land code. It needs to be solved in Filament. |
Donate 💰 to fund this issue
The text was updated successfully, but these errors were encountered: