diff --git a/src/store/index.tsx b/src/store/index.tsx index db4540e6..db289b03 100644 --- a/src/store/index.tsx +++ b/src/store/index.tsx @@ -13,8 +13,17 @@ import { modalsVisibilityStore } from './modals'; } const hydrate = create({ storage: localStorage }); - Promise.all([hydrate('main', mainStore), hydrate('ui', uiStore)]).then(() => { - uiStore.setReady(true); + function hydrateAll() { + Promise.all([hydrate('main', mainStore), hydrate('ui', uiStore)]).then(() => { + uiStore.setReady(true); + }); + } + hydrateAll(); + + document.addEventListener('visibilitychange', () => { + if (document.visibilityState === 'visible') { + hydrateAll(); + } }); })();