Skip to content

Commit

Permalink
fixed react tabs state
Browse files Browse the repository at this point in the history
  • Loading branch information
elraphty committed Jul 8, 2024
1 parent b895186 commit 9e7aedb
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/store/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
})();

Expand Down

0 comments on commit 9e7aedb

Please sign in to comment.