Snapshot and Delta Events
Client state depends on a deliberate snapshot-and-delta pattern:
hydratereturns the initial state during audition.- Later handlers emit delta events such as
MoveMadeorGameEnded. - Client reducers fold deltas into the hydrated state.
Without hydration, a reconnecting UI usually needs a separate imperative fetch path.
Hydrate on connect
export const = .(function* () {
const = yield*
return {
: .,
: .,
: .,
}
})Delta from handlers
export const = (
...,
.(function* ({ }) {
const = yield* ()
yield* ..("MessageAdded", {
,
})
}),
)Reduce locally
export const = .(
"MessageAdded",
({ }) =>
() =>
.({
...,
: [...., ],
}),
)This keeps the client state model hydrated before the UI sees it and event-driven afterward.
Read Lifecycle for hydrate and
Client State for the reduction loop.