Closed bee-interactive closed 9 months ago
Can you please read this issue thoroughly, go through each step and report back with your findings? Thanks.
Hi! Thanks for the feedback.
I have tried with the redirect response, still the same result. I don't have any errors, it just redirects me to the page but no toasts is showned.
Another thing I forgot to mention is that the Component is a ModalComponent, used from the wire-elements/modal package. Maybe a conflict with this one?
@bee-interactive I don't think so.
web
middleware group? You can verify this using php artisan route:list
.StartSession
middleware in the web
group?toaster:received
events? You can inspect this in the Network
tab of Google Chrome, or Safari ... The dispatches
key should contain at least 1 toaster:received
event.Yes everything is correctly set up. I use the toasts in other parts of the application and it's working fine. Except the parts were I redirect the user after an action.. Strange
Could you verify that the ModalComponent
is not the culprit here? Are you redirecting in a non-modal component, ie. standard component elsewhere?
I'm simply redirecting to the home page. No components on the homepage..
Sure, but where you are redirecting from is equally important. That's my question 👍
Sorry :-)
I have the same behavior within a standard controller. After the save, the user is redirected but no toasts is shown.
Here's the update method inside a basic Laravel controller:
public function update(EventUpdateRequest $request, Event $event): RedirectResponse
{
$event->update($request->validated());
return Redirect::route('home')->info(__('The informations have been updated'));
}
Redirects are handled using the active user session, so please double check if it's set up correctly. Non-redirecting action toasts do not use the session (that's why it works).
If everything looks fine... could you please provide a minimal reproduction repository that I can use in order to track down the cause of this issue? Thanks!
Hi @bee-interactive
Is there any link I could use? Thanks a lot.
@mabdullahsari Hi! I will prepare a test repository!
Hi @bee-interactive
Any news on your test repository?
@mabdullahsari Hi! Sorry for the late response. It turns out upgrading my Laravel application and upgrading to the latest version of Livewire fixed the issue.
Hi!
I have some issue to show the toasts after a redirect from a Livewire component. I'm assuming it's because of the redirect but as explain is the readme, it should work.
Here's my actual configuration:
Laravel version: 10.20 PHP version: 8.2 Livewire version 3.0 Toaster version: 2.0
Here's the save method inside my Livewire component:
The rest of the component is only a mount method and some validation rules.
I have tried different approaches inside the save method too:
I have added the Toast package successfully since I can make it work in other components without the redirect (send toast after a modal close event for exemple)
Any ideas were I miss something?
Thanks in advance!