You ship a deploy. A user who had the app open clicks Save, the write works, and the “Saved.” toast never shows up. They click Save again. Now you have two posts. inertia-laravel 3.8 fixes that lost toast, plus two other places where flash data quietly went missing. It also adds Inertia::forgetFlashed(), so you can drop one flashed key before the page renders.
TL;DR
- Deploy fix (#934). When a stale tab triggers the asset-version
409, the flash data is now put back in the session, so the full page reload still gets the toast. In our lab, all three preservation tests fail on 3.7.0 and pass on 3.8.0. - New API (#935).
Inertia::forgetFlashed('toast')removes keys from the flash data before it reaches the page. It takes a string, an array, enum cases and dot notation, returns the factory so you can chain->render(), and does not make the remaining keys live longer. - Two more fixes (#934, #936). Flash data carried over from the previous request now survives an empty response that the middleware turns into
back(), and anInertia::location()response. - PHP 8.6 (#929). The package’s CI now runs on PHP 8.6 with Laravel 13. Nothing to change in your app. Update with
composer update inertiajs/inertia-laravel.
What’s new at a glance#
| Change | PR | What you notice |
|---|---|---|
| Flash data kept on asset version change | #934 | The toast shows after the post-deploy full page reload |
Flash data kept when an empty response becomes back() | #934 | A carried-over toast is no longer eaten by a “return nothing” action |
Inertia::forgetFlashed() | #935 | Remove one flashed key without pulling them all |
Flash data kept on Inertia::location() | #936 | A toast survives the full page visit to the new location |
| PHP 8.6 in the test matrix | #929 | Nothing. The php: ^8.2 constraint is unchanged |
inertia-laravel v3.8.0 was released on November 23, 2026 at 20:34 UTC. It is a server-only release: there is no new @inertiajs/vue3 version, and the client code you already have handles everything below. If flash data is new to you, start with Show a saved message in Vue, which covers Inertia::flash() and the starter kit toast.
The toast that vanished after a deploy#
Here is the sequence that lost the toast on 3.7 and earlier. The tab still runs the old JavaScript bundle, so every request carries the old X-Inertia-Version header.
- The user submits the form. Inertia doesn’t version-check a
POST, so your controller runs, callsInertia::flash()and redirects. - The browser follows the redirect with a
GETthat has the old version. The middleware renders the page, which pulls the flash data out of the session, then notices the version mismatch. - The middleware throws that rendered page away and answers
409withX-Inertia-Location, so the client does a full page load to fetch the new assets. That’s the normal 409 after a deploy. - The full page load renders the page again. The flash data was already pulled in step 2, so
page.flashis empty. No toast.
In 3.8, Response remembers the flash data it pulled in a request attribute, and the default onVersionChange() flashes it back into the session before returning the 409. The next request, the full page load, renders it as usual. Nothing changes in your controllers:
use Inertia\Inertia;
public function store(StorePostRequest $request): RedirectResponse
{
Post::create($request->validated());
Inertia::flash('toast', ['type' => 'success', 'message' => 'Saved.']);
return to_route('posts.index');
}And on the client, nothing changes either. On an initial page load, @inertiajs/core fires the global flash event when page.flash isn’t empty, and the Vue starter kit’s initializeFlashToast() listens to exactly that event. So the restored toast shows on the fresh page, once. Our lab checks that the next visit has no flash key.
Gotcha: onFlash callbacks don't survive a reload
The fix restores the data, not your JavaScript. A per-visit callback like router.post('/posts', data, { onFlash }) belonged to the old page and is gone after the full page load. Handle anything that must work after a deploy in a global listener (router.on('flash', ...)) or by reading page.flash, like the starter kit does.
If you override onVersionChange()#
Some apps override onVersionChange() in HandleInertiaRequests to return the rendered page instead of forcing a reload. That page already contains the flash data, and it still does in 3.8: the upstream test suite covers that case. If your override builds its own response, look at the new parent method before you copy it: the extra lines that restore the flash data only run in the default implementation.
A flash you pulled yourself with Inertia::pullFlashed() is not restored on a version change. That’s deliberate: you took it, so you own it.
Inertia::forgetFlashed(): drop one key#
Until now you could add flash data with Inertia::flash(), read it with Inertia::getFlashed() or take all of it with Inertia::pullFlashed(). There was no clean way to remove a single key. 3.8 adds one:
Inertia::forgetFlashed('toast'); // one key
Inertia::forgetFlashed(['toast', 'highlight']); // several
Inertia::forgetFlashed(FlashKey::Toast); // enum cases, like flash()
Inertia::forgetFlashed('toast.type'); // dot notation reaches into arraysIt returns the ResponseFactory, so it chains straight into render(), the same way flash() does. It works on flash data from the current request and on data carried over from the previous one (the redirect that brought the user here).
A page that already says it#
After registration, the controller flashes “Account created.” and redirects to a welcome page. The welcome page has its own big “Welcome aboard” header, so a toast on top of it is noise. Forget it on that page only:
inertia-laravel 3.7, then inertia-laravel 3.8:
public function __invoke(): Response
{
// pullFlashed() takes everything, so put back what you want to keep
$flash = Inertia::pullFlashed();
unset($flash['toast']);
if ($flash !== []) {
Inertia::flash($flash);
}
return Inertia::render('Welcome');
}public function __invoke(): Response
{
return Inertia::forgetFlashed('toast')->render('Welcome');
}The “before” works, but it has a catch: Inertia::flash() flashes again, so whatever you put back lives for one more request. forgetFlashed() writes the remaining data back without re-flashing it. Our lab confirms it: forget a key on an export endpoint, and the other keys are still gone on the visit after that, exactly like normal flash data.
Drop a highlight that would point at nothing#
Say store() flashes the new post’s ID so the list can highlight its row. If the user lands on a filtered list where that post isn’t visible, the highlight points at nothing. Drop just that key and keep the toast:
public function index(Request $request): Response
{
$posts = Post::query()
->when($request->query('status'), fn ($query, $status) => $query->where('status', $status))
->latest()
->paginate(20);
$highlight = Inertia::getFlashed()['highlight'] ?? null;
if ($highlight !== null && ! $posts->contains('id', $highlight)) {
Inertia::forgetFlashed('highlight');
}
return Inertia::render('posts/Index', ['posts' => $posts]);
}Tip: dot notation removes part of an array
forgetFlashed() uses Arr::forget() under the hood. A literal key that contains a dot ('user.name') is removed as is. Otherwise the dot walks into the array: forgetFlashed('toast.type') leaves ['message' => 'Saved.'] behind, a toast without a type. The starter kit calls toast[data.type](...), so that half-toast would break. Forget the whole toast key instead.
If you forget the last key, the flash key disappears from the page object entirely, so page.flash is an empty object on the client. Calling it when nothing was flashed is a no-op.
Server or client?#
| You want to… | Use | Where |
|---|---|---|
| Remove one key before the page renders | Inertia::forgetFlashed('key') | Controller, middleware |
| Read and remove everything | Inertia::pullFlashed() | Controller |
| Read without removing | Inertia::getFlashed() | Controller |
| Change flash data already on the page | router.flash((current) => ...) | Vue |
The client-side router.flash() callback (Inertia 3) is for data that already arrived, such as clearing a toast after the user dismisses it. forgetFlashed() keeps the key from being sent at all.
The two other flash fixes#
Both fixes are about flash data that was carried over from the previous request and hadn’t been shown yet.
Empty responses. If an Inertia action returns nothing (a void controller method), the middleware turns the empty 200 into a redirect back (onEmptyResponse()). Redirects returned from a controller already reflashed the session. This one didn’t, so carried-over flash data died here. In 3.8 the middleware reflashes when the empty response becomes a redirect.
// The toast from the previous save now survives this round trip.
Route::put('/posts/order', function (Request $request) {
foreach ($request->input('ids', []) as $position => $id) {
Post::whereKey($id)->update(['position' => $position]);
}
});Inertia::location(). A location response is a 409 with an X-Inertia-Location header, and the client follows it with a full page visit. The middleware now treats it like a redirect and reflashes, so the toast reaches the new page. A plain 200 that happens to carry the same header (a file export, say) doesn’t count: the upstream tests check that its flash data is not kept.
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
public function show(): SymfonyResponse
{
// Full page visit to a non-Inertia page. The flashed toast comes along.
return Inertia::location(route('billing.portal'));
}What we tested#
We copied our Inertia 3.11 lab, wrote the tests against inertia-laravel 3.7.0, then updated to 3.8.0 with Laravel 13.43. The test file tests/Feature/InertiaLaravel38FlashTest.php has 10 tests and 65 assertions:
forgetFlashed()with a carried-over key, an array of enum cases, dot notation, the no-op case, and the “doesn’t extend the lifetime” case.- The deploy case: a
POST, aGETwith an oldX-Inertia-Version(409), then a full page load thathasFlash('toast.message', 'Saved.'), and a visit after that with noflashkey. - The empty response and
Inertia::location()cases. - The old pull-and-reflash workaround, to prove the remaining keys really do live one request longer.
On 3.7.0 the nine new-behaviour tests fail (five because forgetFlashed() doesn’t exist, the other four because the flash data is gone). On 3.8.0 all ten pass. The rest of the lab suite has the same results before and after the update.
Check the deploy case in your app
use Inertia\Testing\AssertableInertia as Assert;
it('keeps the toast when the asset version changed', function () {
config()->set('app.asset_url', 'https://cdn.example.com/new-build');
$this->post('/posts', ['title' => 'Hello'], ['X-Inertia' => 'true'])
->assertRedirect('/posts');
$this->get('/posts', ['X-Inertia' => 'true', 'X-Inertia-Version' => 'old-build'])
->assertStatus(409);
$this->get('/posts')->assertInertia(fn (Assert $page) => $page
->hasFlash('toast.message', 'Saved.'));
});Run it with php artisan test --filter=FlashAfterDeploy. Setting app.asset_url changes the version the default version() method returns, which is the easiest way to fake a deploy in a test.
Upgrade notes#
- Update the package.
composer update inertiajs/inertia-laravel(orcomposer require inertiajs/inertia-laravel:^3.8). No client update is needed. - Check custom
onVersionChange()overrides. If yours returns its own response, compare it with the new parent method, or callparent::onVersionChange()to keep the flash restore. - Replace pull-and-reflash workarounds with
Inertia::forgetFlashed(). They kept the remaining keys alive one request longer than you probably meant. - Nothing breaks. No signatures changed. PHP 8.6 support is CI coverage: the
php: ^8.2constraint is the same as before.
Recap#
- After a deploy, the asset-version 409 no longer eats the toast: 3.8 puts the pulled flash data back for the full page load.
Inertia::forgetFlashed()removes keys (strings, arrays, enums, dot notation) without extending the life of the rest.- Carried-over flash data now survives empty responses and
Inertia::location(). - Per-visit
onFlashcallbacks still can’t survive a full page load. Use a globalflashlistener.
FAQ#
Do I need a new @inertiajs/vue3 version for this?
No. inertia-laravel 3.8 is a server-only release. The client already fires the global flash event on the initial page load, which is what shows the restored toast.
What is the difference between forgetFlashed() and pullFlashed()?
pullFlashed() returns all flash data and removes it. forgetFlashed() removes only the keys you name, returns the response factory so you can chain render(), and leaves the rest to age out normally.
Can I forget a nested value inside a flashed array?
Yes, dot notation works (forgetFlashed('toast.type')). Be careful with the starter kit toast: it needs both type and message, so forget the whole toast key.
Why does my onFlash callback still not run after a deploy?
The 409 forces a full page load, so the JavaScript that registered the per-visit callback is gone. 3.8 restores the flash data, not the callback. Use router.on('flash') or read page.flash.
Does inertia-laravel 3.8 require PHP 8.6?
No. The package still requires PHP 8.2 or newer. PR #929 adds PHP 8.6 (with Laravel 13) to its test matrix.
Next steps#
- Show a saved message in Vue:
Inertia::flash(), the starter kit toast andassertInertiaFlash. - Deploy Laravel and Vue: 409 means new assets: why stale tabs get a 409.
- Inertia 3.11 live props: the previous Inertia release we covered.
- Inertia docs: flash data
Sources#
- inertia-laravel v3.8.0 release notes
- Full diff v3.7.0…v3.8.0
- PR #929: support for PHP 8.6
- PR #934: preserve flash data on asset version changes and empty responses
- PR #935: add
Inertia::forgetFlashed() - PR #936: preserve flash data on
Inertia::location()responses - Inertia docs: flash data
- Inertia docs: asset versioning
- Laravel Vue starter kit (
initializeFlashToast)



