whitelist persisted reducers
Summary: We only want to persist certain reducers that are whitelisted. Currently some parts of the `connections` reducer and everything from the other reducers was persisted. This changes the behavior to only persist what is explicitly whitelisted and not the other reducers. These pars of the store are whitelisted: - `connections.userPreferredDevice` - `connections.userPreferredPlugin` - `connections.userPreferredApp` Reviewed By: jknoxville Differential Revision: D10401403 fbshipit-source-id: e4aa4f2b2f8f6229b02dcf46798965fa1ae74df6
This commit is contained in:
committed by
Facebook Github Bot
parent
51f70fd78c
commit
38268fe4c9
23
src/init.js
23
src/init.js
@@ -14,34 +14,15 @@ import Logger from './fb-stubs/Logger.js';
|
||||
import App from './App.js';
|
||||
import BugReporter from './fb-stubs/BugReporter.js';
|
||||
import {createStore} from 'redux';
|
||||
import {persistStore, persistReducer} from 'redux-persist';
|
||||
import createFilter from 'redux-persist-transform-filter';
|
||||
import storage from 'redux-persist/lib/storage/index.js';
|
||||
import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2';
|
||||
import {persistStore} from 'redux-persist';
|
||||
import reducers from './reducers/index.js';
|
||||
import dispatcher from './dispatcher/index.js';
|
||||
import {setupMenuBar} from './MenuBar.js';
|
||||
import TooltipProvider from './ui/components/TooltipProvider.js';
|
||||
const path = require('path');
|
||||
|
||||
const reducer: typeof reducers = persistReducer(
|
||||
{
|
||||
key: 'root',
|
||||
stateReconciler: autoMergeLevel2,
|
||||
transforms: [
|
||||
createFilter('connections', [
|
||||
'userPreferredDevice',
|
||||
'userPreferredPlugin',
|
||||
'userPreferredApp',
|
||||
]),
|
||||
],
|
||||
storage,
|
||||
},
|
||||
reducers,
|
||||
);
|
||||
|
||||
const store = createStore(
|
||||
reducer,
|
||||
reducers,
|
||||
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
|
||||
);
|
||||
persistStore(store);
|
||||
|
||||
Reference in New Issue
Block a user