Skip to content
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

Flashed session values persist for 1 reload #132

faustbrian opened this issue Aug 6, 2019 · 2 comments


Copy link

commented Aug 6, 2019

At the moment flashed session values are persisted for 1 reload after already showing in a component. Below code will show the success message after persist has been executed but when you refresh the page it will still show, after a second reload it will finally be gone as Laravel has seen that the flashed value was used.

// View
    <div>{{ session()->get('success') }}</div>

// Component

namespace App\Http\Livewire;

use Livewire\Component;

class UpdateName extends Component
    /** @var string */
    public $name;

     * Persist all changes.
    public function persist(): void
        // validate...
        // persist...

        session()->flash('success', 'Persisted!');

This is probably a tricky one to solve due to how Livewire works over an AJAX request so Laravel never saw the session value be used directly over a normal HTTP request.


This comment has been minimized.

Copy link
Contributor Author

commented Aug 6, 2019


This would be a dirty solution but it solves the issue of the newly flashed messages persisting outside of the Livewire component. The assumption of this code is that we desire our flashed session values to be only used inside the component.

The flashed part with this code becomes the AJAX request that Livewire fires instead of an in-browser HTTP request like a traditional Laravel application expects.


This comment has been minimized.

Copy link

commented Aug 15, 2019

Merged and tagged: v0.2.5


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.