Skip to content

Instantly share code, notes, and snippets.

@rt2zz
Last active August 28, 2016 21:26
Show Gist options
  • Save rt2zz/d1b11137cdc598a7580db361cf3dfb96 to your computer and use it in GitHub Desktop.
Save rt2zz/d1b11137cdc598a7580db361cf3dfb96 to your computer and use it in GitHub Desktop.
import { createTransform, getStoredState, purgeStoredState } from 'redux-persist'
import { autoRehydrate as baseAutoRehydrate, createPersistor as baseCreatePersistor, persistStore as basePersistStore }
export { createTransform, getStoredState, purgeStoredState }
import immutableConfig from './immutableConfig' // basically verbatim redux-persist-immutable-state but keys renamed: _stateInit, _stateGetter, ...
import stateReconciler from './stateReconciler'
// perhaps we should add some validation to make sure stateReconciler is not being overriden?
export const autoRehydrate = (config, ...args) => {
return baseAutoRehydrate({...config, stateReconciler}, ...args)
}
export const createPersistor = (config, ...args) => {
return baseCreatePersistor({...config, ...immutableConfig}, ...args)
}
export const persistStore = (config, ...args) => {
return basePersistStore({...config, ...immutableConfig}, ...args)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment