Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
fix: do not persist allLanguages, languages, router and review senten…
Browse files Browse the repository at this point in the history
…ces from store (fixes #550) (#559)
  • Loading branch information
MichaelKohler authored Nov 20, 2021
1 parent 0da87d0 commit 97e5217
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
18 changes: 16 additions & 2 deletions web/src/reducers/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { combineReducers } from 'redux';
import { persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import { connectRouter } from 'connected-react-router';
import type { History } from 'history';

Expand All @@ -7,12 +9,24 @@ import login from './login';
import sentences from './sentences';
import settings from './settings';

const languagesPersistConfig = {
key: 'languages',
storage,
blacklist: ['allLanguages', 'languages'],
};

const sentencesPersistConfig = {
key: 'sentences',
storage,
blacklist: ['sentences'],
};

export default function (history: History) {
return combineReducers({
router: connectRouter(history),
languages,
languages: persistReducer(languagesPersistConfig, languages),
login,
sentences,
sentences: persistReducer(sentencesPersistConfig, sentences),
settings,
});
}
1 change: 1 addition & 0 deletions web/src/store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const ROOT_KEY = 'redux';
const persistConfig = {
key: ROOT_KEY,
storage,
blacklist: ['router', 'languages', 'sentences'], // languages and sentences have their own config!
};

function getStore(history: History) {
Expand Down

0 comments on commit 97e5217

Please sign in to comment.