redux-distribute
v0.3.5
Published
redux enhancer ro saving actions a distributable data
Downloads
21
Readme
Redux Distribute
Needs to be able to reason about both our own local state, and a possibly-out-of-sync global state. Reading/writing actions is primary, caching resolved state is secondary.
There are two places to save actions:
- Locally: assumed to always exist, and always be accessable, first thing we'll try to write to
- Globally: possibly exists, possibly accesable. Might contain actions not found in local store, and might be missing actions found in the local store.
There is also a cache of state, but this is very much viewed as a suggestion rather than a rule
Lifecycle
On Startup
- Check to make sure Local and Global actions match, if not, make sure they do
- Read current state cache
- Read current action hash
On Create Action
- Generate an action
- Save it localy,
- Try to save it globally
Required Hooks
readCache(atAction): stateSnapshot
writeCache(atAction, state)
- localActions
writeAction(id, action)
readAction(id): action
listActions(): [id]
- globalActions
writeAction(id, action)
readAction(id): action
listActions(): [id]