Core Concepts
- State updates are serialized through an internal Promise queue.
setState replaces the entire root state.
mergeState performs a shallow root merge ({ ...prev, ...patch }).
- By default, the root state object is frozen after each applied update.
- Selectors are pure read functions over immutable snapshots.
Behavior and Edge Cases
- Updaters returning
void produce a no-op update.
mergeState does not deep-merge nested objects.
- DevTools are auto-enabled when
NODE_ENV !== "production" unless overridden.
- Time-travel operations replace state silently to avoid recursive logging.
- In global mode,
configureGlobalStore should run during app startup.
Architecture Overview
flowchart TD
appCode[ApplicationCode] --> mainEntry[hummbitEntry]
appCode --> reactEntry[hummbitReactEntry]
mainEntry --> globalStore[defaultStoreSingleton]
mainEntry --> initFactory[initStoreFactory]
reactEntry --> globalReactSelector[globalUseSelector]
initFactory --> isolatedStore[isolatedStoreInstance]
globalStore --> updateQueue[serializedUpdateQueue]
isolatedStore --> updateQueue
updateQueue --> applyState[stateApplyReplaceMerge]
applyState --> listeners[listenerSet]
applyState --> devtoolsBridge[reduxDevtoolsAdapter]
applyState --> middlewareHooks[middlewarePipeline]