diff --git a/app/store/utils.js b/app/store/utils.js index 192b70826..494ba42b1 100644 --- a/app/store/utils.js +++ b/app/store/utils.js @@ -42,14 +42,20 @@ export function transformSet(incoming, setTransforms, toStorage = true) { } export function waitForHydration(store, callback) { - const subscription = () => { - if (store.getState().views.root.hydrationComplete) { - unsubscribeFromStore(); - if (callback && typeof callback === 'function') { - callback(); - } + if (store.getState().views.root.hydrationComplete) { + if (callback && typeof callback === 'function') { + callback(); } - }; + } else { + const subscription = () => { + if (store.getState().views.root.hydrationComplete) { + unsubscribeFromStore(); + if (callback && typeof callback === 'function') { + callback(); + } + } + }; - const unsubscribeFromStore = store.subscribe(subscription); + const unsubscribeFromStore = store.subscribe(subscription); + } } \ No newline at end of file