SharedReducer
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
S |
A |
Properties
Section titled “Properties”clientId
Section titled “clientId”readonly clientId: string;Methods
Section titled “Methods”close()
Section titled “close()”close(): void;Returns
Section titled “Returns”void
dispatch()
Section titled “dispatch()”dispatch(action): void;Apply an action everywhere.
Applied locally first so the UI does not wait for a round trip, then proposed to the leader for ordering. If the committed order turns out to differ from the optimistic one, the local value is rebuilt from the committed state — so a dispatch can be seen out of order for a moment, but never settle out of order.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
action | A |
Returns
Section titled “Returns”void
getSnapshot()
Section titled “getSnapshot()”getSnapshot(): S;Immutable, replaced whenever the value changes. Safe for useSyncExternalStore.
Returns
Section titled “Returns”S
pendingCount()
Section titled “pendingCount()”pendingCount(): number;Number of dispatches from this client that have not yet come back committed. Zero means this client’s view is entirely confirmed.
Returns
Section titled “Returns”number
subscribe()
Section titled “subscribe()”subscribe(fn): () => void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fn | () => void |
Returns
Section titled “Returns”() => void