You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’ve encountered an issue with the Tablar alert component when used in conjunction with Livewire. The alerts do not work properly because Livewire does not perform a full page reload, and flash messages defined with Session::flash() are not available during Livewire's render cycle.
Current Behavior
When a Livewire event generates a flash message (e.g., Session::flash('success', 'Profile updated successfully.');), the message is not displayed in the alert.blade.php component. This happens because Tablar's alert component relies entirely on session data.
Expected Behavior
Tablar alerts should work seamlessly with Livewire, displaying success or error messages dynamically triggered by Livewire events.
Steps to Reproduce
Set up a project with Laravel, Tablar, and Livewire.
Include the Tablar alert component on the page:
@include('tablar::common.alert')
Generate a Livewire event that uses Session::flash() to set a flash message.
Observe that the alert is not displayed on the page.
Temporary Solution
I have implemented a temporary workaround by using Livewire events to dynamically update the DOM via JavaScript. Here's an example:
It would be helpful if Tablar's alert system could natively support Livewire events. A potential improvement could include adding a built-in JavaScript listener in the default alert component to intercept events emitted by Livewire and display messages dynamically.
Thank you for the amazing work on Tablar and for taking the time to address this issue! 😊
The text was updated successfully, but these errors were encountered:
Hello,
I’ve encountered an issue with the Tablar alert component when used in conjunction with Livewire. The alerts do not work properly because Livewire does not perform a full page reload, and flash messages defined with
Session::flash()
are not available during Livewire's render cycle.Current Behavior
When a Livewire event generates a flash message (e.g.,
Session::flash('success', 'Profile updated successfully.');
), the message is not displayed in thealert.blade.php
component. This happens because Tablar's alert component relies entirely on session data.Expected Behavior
Tablar alerts should work seamlessly with Livewire, displaying success or error messages dynamically triggered by Livewire events.
Steps to Reproduce
Session::flash()
to set a flash message.Temporary Solution
I have implemented a temporary workaround by using Livewire events to dynamically update the DOM via JavaScript. Here's an example:
Modified
alert.blade.php
:Generating the Event in Livewire:
Feature Request
It would be helpful if Tablar's alert system could natively support Livewire events. A potential improvement could include adding a built-in JavaScript listener in the default alert component to intercept events emitted by Livewire and display messages dynamically.
Thank you for the amazing work on Tablar and for taking the time to address this issue! 😊
The text was updated successfully, but these errors were encountered: