diff options
author | Eric Bailey <git@esb.lol> | 2023-12-09 17:10:12 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-09 15:10:12 -0800 |
commit | 97b54b51c6580737a561b48125af2884b23548f3 (patch) | |
tree | 291cfd18567bb1387523824bbe217bec10dffab0 /src/state/session/index.tsx | |
parent | 6b3eb401b04ee442005a9690dcf90e16d46c35e0 (diff) | |
download | voidsky-97b54b51c6580737a561b48125af2884b23548f3.tar.zst |
Add back isInitialLoad to session (#2155)
Diffstat (limited to 'src/state/session/index.tsx')
-rw-r--r-- | src/state/session/index.tsx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/state/session/index.tsx b/src/state/session/index.tsx index d4cd2fcd2..56208bc70 100644 --- a/src/state/session/index.tsx +++ b/src/state/session/index.tsx @@ -28,6 +28,7 @@ export function getAgent() { export type SessionAccount = persisted.PersistedAccount export type SessionState = { + isInitialLoad: boolean isSwitchingAccounts: boolean accounts: SessionAccount[] currentAccount: SessionAccount | undefined @@ -75,6 +76,7 @@ export type ApiContext = { } const StateContext = React.createContext<StateContext>({ + isInitialLoad: true, isSwitchingAccounts: false, accounts: [], currentAccount: undefined, @@ -150,6 +152,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { const queryClient = useQueryClient() const isDirty = React.useRef(false) const [state, setState] = React.useState<SessionState>({ + isInitialLoad: true, isSwitchingAccounts: false, accounts: persisted.get('session').accounts, currentAccount: undefined, // assume logged out to start @@ -434,6 +437,11 @@ export function Provider({children}: React.PropsWithChildren<{}>) { } } catch (e) { logger.error(`session: resumeSession failed`, {error: e}) + } finally { + setState(s => ({ + ...s, + isInitialLoad: false, + })) } }, [initSession], |