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

forget flashed session content if we are not redirecting #141

Merged
merged 1 commit into from Aug 15, 2019

Conversation

@faustbrian
Copy link
Contributor

commented Aug 7, 2019

1️⃣ Is this something that is wanted/needed? Did you create a feature-request issue first?
Yes #132

2️⃣ Does it contain multiple, unrelated changes? Please separate the PRs out.
No

3️⃣ Does it include tests if possible? (Not a deal-breaker, just a nice-to-have)
Yes

4️⃣ Please include a thorough description of the feature/fix and reasons why it's useful.
As described in #132 all flashed contents of a session is persisted for 1 in-browser page reload even though Livewire already rendered the contents.

This PR changes the connection handler to assume that if there is no redirect it means that the contents was already rendered by the component itself. This change results in 2 scenarios now.

  1. We call session()->flash() inside our component but don't call $this->redirect() so the flashed content is removed after it has been added to the AJAX response.
  2. We call session()->flash() inside our component and call $this->redirect() so we are redirected, the content is flashed and removed by Laravel and its session handler.

5️⃣ Thanks for contributing! 🙌

@faustbrian faustbrian force-pushed the faustbrian:fix/session-flash branch from 06537b2 to ee1bdb5 Aug 7, 2019

@faustbrian

This comment has been minimized.

Copy link
Contributor Author

commented Aug 13, 2019

@calebporzio any chance of getting a review on this?

@calebporzio

This comment has been minimized.

Copy link
Owner

commented Aug 15, 2019

@faustbrian, sorry for the lag on reviewing this. Like all your contributions, the problem is clearly stated and the solution is smart, clear, and well tested. Thanks a ton!

@calebporzio calebporzio merged commit 6a99519 into calebporzio:master Aug 15, 2019

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@faustbrian faustbrian deleted the faustbrian:fix/session-flash branch Aug 16, 2019

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