Inertia’s Laravel adapter reached v3.8.0 on 23 November 2026. It’s a small release with four changes: support for PHP 8.6, a new Inertia::forgetFlashed() method, and two fixes so flash data no longer goes missing when your app redirects in certain ways. If you use Inertia’s flash data for toasts, “record created” banners or newly created IDs, this one is worth installing.
This tutorial recaps how flash data works in Inertia v3, then shows each change with Laravel code you can drop into a controller.
Quick refresher: flash data in Inertia v3
Flash data is one-time data sent to the front end. Unlike normal props, it isn’t saved in browser history state, so it won’t reappear when someone presses Back. The official flash data docs describe the server API:
use Inertia\Inertia;
public function store(StoreUserRequest $request)
{
$user = User::create($request->validated());
Inertia::flash([
'toast' => ['type' => 'success', 'message' => 'User created!'],
'newUserId' => $user->id,
]);
return back();
}
You can also chain it: return Inertia::flash('newUserId', $user->id)->back();, or attach it to a render with Inertia::render(...)->flash('highlight', $project->id).
On the client, the data appears on page.flash. You can also handle it with the onFlash request callback or the global flash event:
import { usePage } from "@inertiajs/react";
export default function Layout({ children }) {
const { flash } = usePage();
return (
<>
{flash.toast && <div className="toast">{flash.toast.message}</div>}
{children}
</>
);
}
The Inertia middleware saves flash data to the session when you redirect, and clears it once it has reached the client.
Upgrading to 3.8.0
composer require inertiajs/inertia-laravel:^3.8
php artisan optimize:clear
Check that you’re on the new release:
composer show inertiajs/inertia-laravel | grep versions
No config changes are needed.
New: Inertia::forgetFlashed()
Until now, once something was flashed you couldn’t take it back during the same request. That’s awkward when a later step changes the outcome. For example, a service flashes “Payment received”, and then a webhook check in the same request fails.
PR #935 adds forgetFlashed(). In the 3.8.0 source it accepts one key or an array of keys, and string-backed or unit enums work as keys too:
use Inertia\Inertia;
public function update(Order $order, OrderService $orders)
{
Inertia::flash([
'toast' => ['type' => 'success', 'message' => 'Order updated'],
'confettiFor' => $order->id,
]);
if (! $orders->syncWithWarehouse($order)) {
// Remove only the misleading parts and keep anything else that was flashed
Inertia::forgetFlashed(['toast', 'confettiFor']);
Inertia::flash('toast', [
'type' => 'warning',
'message' => 'Saved, but the warehouse sync failed. We will retry.',
]);
}
return back();
}
There’s a detail in the implementation worth knowing. forgetFlashed() writes the remaining data back to the session without flashing it again, so whatever is left still expires after the request it was flashed for. Forgetting one key doesn’t keep the others alive for longer.
Since enums are accepted, you can keep your flash keys in one place:
enum Flash: string
{
case Toast = 'toast';
case NewId = 'newId';
}
Inertia::flash(Flash::Toast, ['type' => 'info', 'message' => 'Draft saved']);
Inertia::forgetFlashed(Flash::Toast);
The flash() method in 3.8.0 resolves enums the same way: a backed enum uses its value, and a unit enum uses its name.
Fix: flash data survives asset version changes
Inertia uses an asset version to detect new front-end deploys. When the version a browser sends doesn’t match the server’s, Inertia forces a full page reload so the user gets the fresh JavaScript bundle.
Before 3.8.0, flash data set on that request could be lost during the forced reload. Deploy in the middle of someone submitting a form, and they’d never see the “Saved!” toast. PR #934 keeps flash data across asset version changes and across empty responses.
You don’t need to change any code. To check the fix in staging:
- Open a page and keep the tab open.
- Bump your asset version, either by deploying a new build or by changing
version()in yourHandleInertiaRequestsmiddleware. - Submit a form that flashes a toast.
- After the full reload, the toast should still appear.
// app/Http/Middleware/HandleInertiaRequests.php
public function version(Request $request): ?string
{
// A quick way to force a mismatch while testing locally
return 'test-'.config('app.asset_version', '1');
}
Fix: flash data survives Inertia::location()
Inertia::location() does an external redirect, or a full-page visit to a non-Inertia URL inside your app, such as a Blade-rendered billing page or an OAuth flow. PR #936 makes sure flash data set before the redirect isn’t dropped.
public function startCheckout(Request $request)
{
Inertia::flash('toast', [
'type' => 'info',
'message' => 'Redirecting you to the secure checkout...',
]);
// Full page visit to a non-Inertia route that later sends the user back
return Inertia::location(route('billing.portal'));
}
This matters most when the destination page sends the user straight back into your Inertia app.
PHP 8.6 support
PR #929 adds support for PHP 8.6, which came out on 19 November. If you were waiting on your Inertia adapter before trying PHP 8.6 in CI, add it to your test matrix now:
# .github/workflows/tests.yml
strategy:
matrix:
php: ['8.4', '8.5', '8.6']
Testing flash data
Laravel’s HTTP tests let you assert what was flashed before the redirect. The adapter stores Inertia flash data under its own session key, so the cleanest approach is a feature test that follows the redirect and checks the page response. Here’s a simple pattern that doesn’t depend on internal session keys:
public function test_failed_sync_replaces_success_toast(): void
{
$this->mock(OrderService::class)
->shouldReceive('syncWithWarehouse')->andReturn(false);
$order = Order::factory()->create();
$this->actingAs(User::factory()->create())
->from(route('orders.edit', $order))
->put(route('orders.update', $order), ['status' => 'shipped'])
->assertRedirect(route('orders.edit', $order));
// Follow-up request: the warning toast should be the one that reaches the page
$this->get(route('orders.edit', $order))
->assertInertia(fn ($page) => $page->component('Orders/Edit'));
}
See the Inertia testing docs for the full set of assertInertia helpers your version supports.
Takeaway
Inertia Laravel 3.8.0 is a safe minor upgrade that makes flash messages more reliable. Toasts now survive deploy-time reloads and Inertia::location() redirects, and Inertia::forgetFlashed() lets you correct a message before it reaches the user. Run composer require inertiajs/inertia-laravel:^3.8, add PHP 8.6 to your CI matrix, and read the full release notes.
