Flash messages
Send one-shot messages (toasts, alerts) to the client. The client passes them to the onFlash callback and the inertia:flash event on the next render, including the initial visit. Then it clears them from history so they don't replay on back/forward:
ts
app.post('/users', async (c) => {
await createUser(c);
c.var.inertia.flash({ success: 'User created' });
return c.var.inertia.render('Users/Index', { users });
});flash() accumulates across calls, and later keys win. Flash data is a top-level field and never mixes into your props.
With the session option, flash data set before a redirect shows on the next page:
ts
app.post('/users', async (c) => {
await createUser(c);
c.var.inertia.flash({ success: 'User created' });
return c.redirect('/users');
});Without it, flash() applies to the current response only.