useLiveQuery, and writes go through the Smithers domain API. The collection provider changes with the workspace mode.
WorkspaceMode
WorkspaceMode selects the provider:
SmithersGatewayProvider chooses local mode by default from the Gateway client base URL. Pass mode to createGatewayReactRoot or SmithersGatewayProvider when you need multiplayer reads.
Collections
createSmithersCollections(mode, queryClient) returns the same collection names in every mode:
useGatewayNodeOutput and useGatewayRpc("getNodeDiff", ...); they are 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 uses bounded buffers. When the ring cannot replay a missed sequence, it sends a reset event and the client invalidates every collection key.
SQLite and embedded PGlite mutating routes return { seq }. That seq is the invalidation sequence that confirms the local optimistic write.
Multiplayer Provider
Multiplayer workspaces use the official ElectricCollection provider through@smithers-orchestrator/electric-proxy:
useLiveQuery code do not branch by mode.
Writes still go through /v1/api/*. Postgres mutating routes return { txid }, captured inside the write transaction with pg_current_xact_id()::xid::text. Electric transaction matching uses that txid to confirm optimistic state once the shape stream catches up.
React Hooks
The workflow UI hook surface is preserved on top of collections:useSmithersCollections() when you need a custom collection query:
Domain Writes
Collection mutation handlers call the same domain API thatuseGatewayActions() calls:
txid. Shape streams are read paths only.