Inertia.js v3.11.0 and inertia-laravel v3.7.0 add live props. A live prop reloads when a broadcast event arrives, which updates the page without polling.
Inertia::live()
and->live()
mark a prop to refresh on a broadcast event- An
echo()
transport for Laravel Echo and Reverb, plus Pusher and Action Cable transports Inertia::broadcastProps()
sends new values inside the event, which skips the reload request- A
useProp()
hook reports when a prop is refreshing
Live Props
Pascal Baljet added live props to both the client and the Laravel adapter. On the server, wrap a prop with Inertia::live()
and pass the event that should refresh it. Inertia reads the channels from the event's broadcastOn()
method:
use App\Events\OrderUpdated; use Inertia\Inertia; return Inertia::render('Orders/Show', [ 'order' => Inertia::live(fn () => $order->fresh(), on: new OrderUpdated($order)), ]);
On the client, pass a transport to createInertiaApp()
. The echo()
helper uses the Echo instance that configureEcho()
sets up:
import { createInertiaApp } from '@inertiajs/vue3' import { echo } from '@inertiajs/vue3/echo' import { configureEcho } from '@laravel/echo-vue' configureEcho({ broadcaster: 'reverb' }) createInertiaApp({ live: echo(), })
When OrderUpdated
is broadcast, Inertia makes a partial…