Skip to content

Commit 7fb3dab

Browse files
committed
Added sanitize of persisted options
1 parent 3b0bcf4 commit 7fb3dab

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

App/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import reducer from './reducers'
1515
import App from './containers/App'
1616

1717
import "./styles/main.less";
18+
import {sanitizePersistedOptions} from "./reducers/options";
1819

1920

2021
const middleware = [thunk, promiseMiddleware()];
@@ -30,6 +31,8 @@ const persistedState = loadState();
3031
*/
3132
if (persistedState !== undefined) {
3233
delete persistedState.options.hydrated;
34+
35+
sanitizePersistedOptions(persistedState.options);
3336
}
3437

3538
const store = createStore(

App/reducers/options.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,5 +382,10 @@ export const options = (state = initialState, action) => {
382382
default:
383383
return state
384384
}
385-
386385
};
386+
387+
export function sanitizePersistedOptions(persistedOptions) {
388+
if (!Array.isArray(persistedOptions.stringArrayEncoding)) {
389+
persistedOptions.stringArrayEncoding = [persistedOptions.stringArrayEncoding];
390+
}
391+
}

0 commit comments

Comments
 (0)