From 2b96279103e0807abc5e7b00d0d3b5369b19b795 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Fri, 21 Apr 2023 20:28:19 -0500 Subject: Fix link opening (#512) --- src/state/models/root-store.ts | 9 +++++++-- src/state/models/session.ts | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/state/models/root-store.ts b/src/state/models/root-store.ts index 6f919a4bf..8cd23efcd 100644 --- a/src/state/models/root-store.ts +++ b/src/state/models/root-store.ts @@ -119,12 +119,17 @@ export class RootStoreModel { /** * Called by the session model. Refreshes session-oriented state. */ - async handleSessionChange(agent: BskyAgent) { + async handleSessionChange( + agent: BskyAgent, + {hadSession}: {hadSession: boolean}, + ) { this.log.debug('RootStoreModel:handleSessionChange') this.agent = agent this.me.clear() await this.me.load() - resetNavigation() + if (!hadSession) { + resetNavigation() + } } /** diff --git a/src/state/models/session.ts b/src/state/models/session.ts index 96e058c02..c36537601 100644 --- a/src/state/models/session.ts +++ b/src/state/models/session.ts @@ -158,11 +158,12 @@ export class SessionModel { */ async setActiveSession(agent: BskyAgent, did: string) { this._log('SessionModel:setActiveSession') + const hadSession = !!this.data this.data = { service: agent.service.toString(), did, } - await this.rootStore.handleSessionChange(agent) + await this.rootStore.handleSessionChange(agent, {hadSession}) } /** -- cgit 1.4.1