From 79cf57abe49beaf9cfc703dcffd7e8b470fb401a Mon Sep 17 00:00:00 2001 From: Hampus Date: Mon, 24 Aug 2026 12:43:15 +0200 Subject: [PATCH] perf(app): keep gateway and layer manager off the auth session path (#1906) --- .../features/platform/state/AuthSession.ts | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/fluxer_app/src/features/platform/state/AuthSession.ts b/fluxer_app/src/features/platform/state/AuthSession.ts index 06e39b4ef..3b2bff6ae 100644 --- a/fluxer_app/src/features/platform/state/AuthSession.ts +++ b/fluxer_app/src/features/platform/state/AuthSession.ts @@ -11,7 +11,6 @@ import accountStorage, { type UserData, } from '@app/features/auth/state/AccountStorage'; import Sudo from '@app/features/auth/state/AuthSudo'; -import GatewayConnection from '@app/features/gateway/transport/GatewayConnection'; import { type Account, type AuthSessionMachineEvent, @@ -31,7 +30,6 @@ import AppStorage from '@app/features/platform/state/PersistentStorage'; import {http} from '@app/features/platform/transport/RestTransport'; import {Logger} from '@app/features/platform/utils/AppLogger'; import LocalPresence from '@app/features/presence/state/LocalPresence'; -import LayerManager from '@app/features/ui/state/LayerManager'; import {action, makeAutoObservable} from 'mobx'; export {type Account, SessionState}; @@ -99,10 +97,22 @@ function createDefaultAuthSessionDependencies(): AuthSessionDependencies { appStorage: AppStorage, http, getRuntimeSnapshot: () => RuntimeConfig.getSnapshot(), - closeLayers: () => LayerManager.closeAll(), + closeLayers: () => { + void import('@app/features/ui/state/LayerManager').then((module) => { + module.default.closeAll(); + }); + }, clearSudoToken: () => Sudo.clearToken(), - sendInvisiblePresence: (reason) => GatewayConnection.sendInvisiblePresenceForCurrentSession(reason), - cleanupGatewaySession: () => GatewayConnection.logout(), + sendInvisiblePresence: (reason) => { + void import('@app/features/gateway/transport/GatewayConnection').then((module) => { + module.default.sendInvisiblePresenceForCurrentSession(reason); + }); + }, + cleanupGatewaySession: () => { + void import('@app/features/gateway/transport/GatewayConnection').then((module) => { + module.default.logout(); + }); + }, resetSyncedUserSettings: () => { void import('@app/features/user/state/UserSettings').then((module) => { module.default.handleAccountTransition();