inertiajs / pingcrm

A demo application to illustrate how Inertia.js works.
http://demo.inertiajs.com
MIT License
2.14k stars 781 forks source link

Flash message re-appears on page navigation #102

Closed iamniels closed 3 years ago

iamniels commented 3 years ago

When a flash message is closed by the user, it will re-appear when the user navigates back to the page.

How to reproduce:

Especially when flash messages appear with some animation, this is troublesome, because to the user it appears that the message is a result to something he just did.

iamniels commented 3 years ago

Any ideas for an approach?

One idea is to add unique identifiers to the messages and to store in the browser's local storage whether a message has been displayed already or not. But this seems overly complicated to me.

reinink commented 3 years ago

This is expected behaviour with Inertia.js. The flash message is sent from the server as a prop, and props are saved in history. This is desirable, and follows standard browser behaviour, where navigating through history shows the page exactly as it was when navigated away from.