From cf48420971ea8b3f73141aa802b0fcf0d4d6ad41 Mon Sep 17 00:00:00 2001 From: Piotr Frankowski Date: Tue, 31 Oct 2017 10:36:57 +0100 Subject: [PATCH] Don't process if localStorage is nonexistent (f.e. server-side) --- src/persistState.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/persistState.js b/src/persistState.js index dfb63bb..d98aae7 100644 --- a/src/persistState.js +++ b/src/persistState.js @@ -36,6 +36,11 @@ export default function persistState(paths, config) { } = cfg return next => (reducer, initialState, enhancer) => { + + if (typeof localStorage === 'undefined') { + return next(reducer, initialState, enhancer) + } + if (typeof initialState === 'function' && typeof enhancer === 'undefined') { enhancer = initialState initialState = undefined