Repository navigation
Commit d99d3fe
committed
Add live props
Props can now refresh themselves when a broadcast event arrives. Always,
deferred, once and optional props gain live(), Inertia::live() creates a
live prop directly, and the page advertises each prop's channels, events
and throttle so the client can subscribe. Inertia::broadcastProps() lets
an event carry the new values itself, and DevTools flags live props.
Port of inertiajs/inertia-laravel#901 at 3.x e68dadfc16, with
inertiajs/docs#96 at main 8cfece18fd. The docs keep the client version
badges, mark live props as v3.11.0+, and leave out the Rails-only Action
Cable setup.
Hypervel adaptations:
- When an outgoing channel formatter is registered, live props advertise
the formatted channels the broadcaster actually sends on, reading the
channel type back from its prefix. Broadcaster::channelFormatter()
exposes the registered formatter for this.
- Canceled requests are no longer turned into ordinary errors while
reading event names and channels, rescuing deferred props, or reading
and flushing DevTools entries. A canceled flush previously disabled
DevTools recording for the worker.
- A rescued prop returned from a closure is now left out of the response
with its metadata, as one resolved directly is. Upstream sent null and
fresh live listeners for it.
- The broadcast values docs say that deferred and optional props are
resolved, matching the code.
All upstream LivePropTest, BroadcastPropsTest and DevTools test changes
are ported, with regressions for formatted channels, cancellation and
closure-returned rescued props. The Inertia and Broadcasting suites,
facade docblock checks, analysis and formatting pass.1 parent cfceb0d commit d99d3fe
1 file changed
Lines changed: 506 additions & 5 deletions
0 commit comments