useLiveQuery, writes through the domain API, and the provider changes with workspace mode.
WorkspaceMode
WorkspaceMode selects the provider:
SmithersGatewayProvider defaults to local mode from the Gateway client base URL; pass mode to createGatewayReactRoot or SmithersGatewayProvider for multiplayer.
Collections
createSmithersCollections(mode, queryClient) returns the same collection names in every mode:
useGatewayNodeOutput and useGatewayRpc("getNodeDiff", ...), not collection rows.
Local Provider
Local workspaces use the official QueryCollection provider over the Gateway REST domain API:GET /v1/api/stream is an SSE invalidation feed; change frames look like this:
/v1/api/*; the stream coalesces bursts, sends heartbeats, reconnects with backoff, and bounds its buffers, sending a reset event (which invalidates every collection key) when the ring can’t replay a missed sequence.
SQLite and embedded PGlite mutating routes return { seq }, the invalidation sequence that confirms the local optimistic write.
Multiplayer Provider
Multiplayer workspaces use the official ElectricCollection provider through@smthrs/electric-proxy:
useLiveQuery code never branch on mode.
Writes still go through /v1/api/*: Postgres mutating routes return { txid }, captured inside the write transaction with pg_current_xact_id()::xid::text, which Electric transaction matching uses to confirm optimistic state once the shape stream catches up.
React Hooks
The workflow UI hook surface is preserved on top of collections:useSmithersCollections() for a custom collection query:
Domain Writes
Collection mutation handlers call the same domain API thatuseGatewayActions() calls:
txid for multiplayer. Shape streams are read-only.