Stunk
Stunk integrates through createStunkStoreAdapter — a thin bridge around exactly one chunk, so dispatchToStore's setState fallback has something concrete to call. No top-level store object involved at all.
- A chunk created with chunk() — see Stunk's docs if you're new to it
- Familiarity with register() — see api/register
A plain Stunk chunk
Registering with createStunkStoreAdapter
createStunkStoreAdapter and pass the result as store — the adapter takes a single chunk, nothing else.Why Stunk needs an adapter
.get(), .set(), and .subscribe() — not setState. The adapter exists purely to give dispatchToStore's fallback path something to call.Handling sparse updates & live delta events
CREATE, sparse UPDATE, and DELETE) alongside initial full array hydration payloads. Write a custom adapter object to update the chunk appropriately:One adapter, one chunk — fanning out to more with batch()
createStunkStoreAdapter only ever wraps one chunk. The moment a single channel needs to update more than one — a list plus a derived count, for example — reach for hydrateState along with Stunk's native batch() helper.Always wrap multi-chunk writes in batch()
chunk.set() call notifies its own subscribers independently by default — wrapping a fan-out in Stunk's own batch() collapses that back into a single notification cycle.Redux and Jotai rarely hit this problem in practice, since one store object can hold multiple slices/atoms internally and update them together from inside its own logic. Stunk's atomic, one-chunk-per-piece-of-state design is what makes both the fan-out pattern and the batch() wrapping worth calling out here specifically — it requires zero changes to the core engine to use this way.
Combining with scope
scope exactly like any other state manager — the adapter layer has no awareness of multi-tenant scoping at all.Stunk vs. other state managers
For Zustand, Flux's native option, see state-managers/zustand. For Redux, see state-managers/redux. For Jotai, see state-managers/jotai. For every other registration field alongside store, see api/register.