InertiaJS flash message persistence during partial reloads
0 reputation · 28 Oct 2020, 19:31 UTC
InertiaJS allows server-side flash data to be passed to the client via the $page.props.flash object. This mechanism is intended to provide one-time notifications following a redirect or a specific server action.
When utilizing router.visit() with preserveState: true, the client-side page object retains its current state. Because partial reloads do not automatically clear previously consumed flash messages from the props object, there is a risk of notification noise where the same alert persists or reappears across unrelated partial updates.
The current implementation lacks a built-in acknowledgment or deduplication system to signal to the server that a flash message has been displayed and should be discarded without requiring a full page navigation.
- What is the recommended pattern for clearing flash props during partial reloads to prevent duplicate alerts?
- Is there a documented way to synchronize the consumption of flash messages between the client and server without triggering a full page visit?