Redux
Redux integrates through createReduxStoreAdapter or a custom adapter object — bridging dispatchToStore's setState fallback to Redux's action dispatch model.
- A Redux store from configureStore() and action creators from createSlice() — see Redux Toolkit's docs if you're new to it
- Familiarity with register() — see api/register
A plain Redux slice and store
setItems), optimistic placeholder additions (addOptimisticItem), single confirmed item upserts (upsertItem), and removals (removeItem):Registering with createReduxStoreAdapter
createReduxStoreAdapter:Why Redux needs an adapter
dispatch() — there is no native setState method. The adapter exists to give dispatchToStore's fallback path a concrete function to invoke.Handling sparse updates & single delta events
CREATE, sparse UPDATE, and DELETE) alongside initial array hydrations. Use a hand-written adapter object to route incoming data to the correct Redux action:Reaching for hydrateState
createReduxStoreAdapter but need to dispatch multiple actions or perform side effects upon payload arrival, pass a custom hydrateState callback during registration:createReduxStoreAdapter is deliberately single-action. If a channel needs to fan out to more than one reducer, use hydrateState or a custom adapter object as shown above.
Deleting a record: online vs offline
DELETE frame to removeItem(). What is still missing is the other half — actually triggering a delete from your UI, and making sure it survives being offline when it happens.If the record was created offline and never replayed, there is no server row to delete — dispatch the local removal and clear the pending CREATE from the queue instead of queuing a DELETE that would 404.
Combining with scope
scope exactly like any other state manager — the adapter layer has no awareness of multi-tenant scoping at all.Local writes: dispatchLocalUpdate()
flux.dispatchLocalUpdate(channel, data, options?) and it flows through the same adapter setState() — and so the same dispatch() call — that bootstrap and realtime data already use.Call dispatchLocalUpdate only once the server has accepted the mutation — it persists to IDB and mirrors to other tabs immediately, so it is a confirmed-write dispatch, not an optimistic one.
Redux vs. other state managers
Because Redux Toolkit employs Immer under the hood, action handlers triggered by itemsAdapter can perform structural updates without manual object spread boilerplate. Flux guarantees payloads dispatched into reducers conform strictly to plain JSON-serializable primitives.
For Zustand, Flux's native option, see state_managers/zustand. For Jotai, see state_managers/jotai. For Stunk, see state_managers/stunk. For the full offline write queue, see core_concepts/offline_queue. For every other registration field alongside store, see api/register.