Skip to content

Commit

Permalink
Persist settings
Browse files Browse the repository at this point in the history
Fixes #2
  • Loading branch information
subnomo committed Apr 5, 2018
1 parent 041b519 commit 245823f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
"react-router-redux": "^5.0.0-alpha.8",
"redux": "^3.7.2",
"redux-immutable": "^4.0.0",
"redux-persist": "^5.4.0",
"redux-persist-immutable": "^4.3.1",
"redux-saga": "^0.16.0",
"reselect": "^3.0.1",
Expand Down
6 changes: 5 additions & 1 deletion src/renderer/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createStore, applyMiddleware, compose } from 'redux';
import { persistStore, autoRehydrate } from 'redux-persist-immutable';
import { fromJS } from 'immutable';
import { routerMiddleware } from 'react-router-redux';
import createSagaMiddleware from 'redux-saga';
Expand All @@ -18,6 +19,7 @@ export function configureStore(history: any, initialState = {}) {

const enhancers = [
applyMiddleware(...middlewares),
autoRehydrate(),
];

const composeEnhancers =
Expand All @@ -35,14 +37,16 @@ export function configureStore(history: any, initialState = {}) {
const store = createStore(
createReducer(),
fromJS(initialState),
composeEnhancers(...enhancers)
composeEnhancers(...enhancers),
);

// Extensions
(store as any).runSaga = sagaMiddleware.run;
(store as any).injectedReducers = {}; // Reducer registry
(store as any).injectedSagas = {}; // Saga registry

persistStore(store, { whitelist: ['settings'] });

return store;
}

Expand Down
4 changes: 0 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3848,10 +3848,6 @@ redux-persist@^4.0.0:
lodash "^4.17.4"
lodash-es "^4.17.4"

redux-persist@^5.4.0:
version "5.4.0"
resolved "https://registry.yarnpkg.com/redux-persist/-/redux-persist-5.4.0.tgz#a1062313546a9d4ca6f9271464d18f736e8ca394"

redux-saga@^0.16.0:
version "0.16.0"
resolved "https://registry.yarnpkg.com/redux-saga/-/redux-saga-0.16.0.tgz#0a231db0a1489301dd980f6f2f88d8ced418f724"
Expand Down

0 comments on commit 245823f

Please sign in to comment.