From 379c5121aa0ee25a418e874fea8e1908114cb035 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Mon, 15 May 2023 10:55:44 +0200 Subject: [PATCH] Fix global state saving to local storage on login (#3168) --- src/global/actions/ui/initial.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/global/actions/ui/initial.ts b/src/global/actions/ui/initial.ts index cde157898..6447d8e0b 100644 --- a/src/global/actions/ui/initial.ts +++ b/src/global/actions/ui/initial.ts @@ -14,7 +14,7 @@ import { startWebsync, stopWebsync } from '../../../util/websync'; import { subscribe, unsubscribe } from '../../../util/notifications'; import { clearCaching, setupCaching } from '../../cache'; import { decryptSessionByCurrentHash } from '../../../util/passcode'; -import { storeSession } from '../../../util/sessions'; +import { hasStoredSession, storeSession } from '../../../util/sessions'; import { callApi } from '../../../api/gramjs'; import type { ActionReturnType, GlobalState } from '../../types'; import { updateTabState } from '../../reducers/tabs'; @@ -51,7 +51,9 @@ addActionHandler('switchMultitabRole', async (global, actions, payload): Promise storeSession(session, session.userId); } - setupCaching(); + if (hasStoredSession(true)) { + setupCaching(); + } global = getGlobal(); if (!global.passcode.hasPasscode || !global.passcode.isScreenLocked) {