perf(app): keep gateway and layer manager off the auth session path (#1906)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-24 12:43:15 +02:00
1 parent 075bdb5128
commit 79cf57abe4
1 file changed
+15 -5
@@ -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();