From 42d7dc1c6c7137854c07523f67937f3eea86346d Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 3 Jan 2023 11:08:39 -0600 Subject: [PATCH] Fix session hydration during load --- src/state/index.ts | 2 +- src/state/models/root-store.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/state/index.ts b/src/state/index.ts index bc8a1694..5c8b50ef 100644 --- a/src/state/index.ts +++ b/src/state/index.ts @@ -23,12 +23,12 @@ export async function setupState() { rootStore = new RootStoreModel(api) try { data = (await storage.load(ROOT_STATE_STORAGE_KEY)) || {} + rootStore.log.debug('Initial hydrate', {hasSession: !!data.session}) rootStore.hydrate(data) } catch (e: any) { rootStore.log.error('Failed to load state from storage', e) } - rootStore.log.debug('Initial hydrate') rootStore.session .connect() .then(() => { diff --git a/src/state/models/root-store.ts b/src/state/models/root-store.ts index 5349f10d..5646157c 100644 --- a/src/state/models/root-store.ts +++ b/src/state/models/root-store.ts @@ -88,6 +88,9 @@ export class RootStoreModel { if (hasProp(v, 'onboard')) { this.onboard.hydrate(v.onboard) } + if (hasProp(v, 'session')) { + this.session.hydrate(v.session) + } if (hasProp(v, 'shell')) { this.shell.hydrate(v.shell) }