Skip to content

Inertia.js 3.11 adds live props that update over a broadcast

A new Inertia::live() helper refreshes a page prop whenever a broadcast event fires, with transports for Laravel Echo, Pusher and Action Cable.

Source: Inertia.js

Inertia.js 3.11, released on 2 November, adds live props: a prop that reloads itself whenever a broadcast event arrives, without the client polling for it. You mark a prop live on the server and give it an event to listen for, and Inertia does a partial reload of just that prop when the event fires.

Inertia::render('Orders/Show', [
    'order' => Inertia::live(fn () => $order->fresh(), on: new OrderUpdated($order)),
]);

The client needs a transport passed to createInertiaApp. Laravel apps wire up Echo and Reverb, but the release also ships transports for Pusher and Action Cable, plus an interface for anything else that can push events. Multiple live props listening to the same channel and event batch into a single request. Merge props can’t be made live, and props marked optional only start listening once the page has actually loaded them.

Why it matters: this removes the usual choice between Inertia’s polling helpers and reaching for a separate real-time library just to keep one prop fresh. A dashboard value, an order status, a live count, any of these can now update itself the moment the server broadcasts, with no client-side polling loop to tune or throttle.

Share

Related reading

More from The Wire

All briefs