Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const persistPlugin = (
persistConfig = {},
persistStoreConfig,
callback
): Plugin => {
// merge config with common config options
const mergedConfig = {
key: 'root',
storage,
...persistConfig,
}
return {
config: {
// pass in merged config as first param of persistCombineReducers
redux: {
combineReducers: persistCombineReducers.bind(null, mergedConfig),
},
},
onStoreCreated(store) {
// run persist store once store is available
persistor = persistStore(store, persistStoreConfig, callback)
},
}
}
['count']
);
const persistConfig = {
transforms: [saveSubsetFilter, immutableTransform()],
keyPrefix: 'mickey-immutable:',
storage,
whitelist: ['counter'],
key: 'primary',
stateReconciler: autoMergeImmutable // rehydrate immutable state
}
// 1. Initialize
const app = createApp({
initialState: {}, //must be a no-immutable object
extensions: {
combineReducers: MickeyPersist(persistCombineReducers.bind(this, persistConfig), combineReducers),
},
})
// 2. Model
app.model(require('./models/counter.js'))
// 3. View
app.render(null, document.getElementById('root'), {
beforeRender: ({ store }) => new Promise(((resolve) => {
resolve(
);
})),
})
const saveSubsetFilter = createFilter(
'counter',
['count']
);
const persistConfig = {
transforms: [saveSubsetFilter],
keyPrefix: 'mickey:',
storage,
whitelist: ['counter'],
key: 'primary'
}
// 1. Initialize
const app = createApp({
extensions: {
combineReducers: MickeyPersist( persistCombineReducers.bind(this, persistConfig) ),
}
})
// 2. Model
app.model(require('./models/counter.js'))
// 3. View
app.render(null, document.getElementById('root'), {
beforeRender: ({ store }) => new Promise(((resolve) => {
resolve(
);
})),
})