From d3dbeffb87de549ad0d6444f8c47f6222b720829 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Thu, 13 Jan 2022 15:06:30 +0100 Subject: [PATCH] Clear websync setting before switching to another web version --- src/components/left/main/LeftMainHeader.tsx | 2 ++ src/util/websync.ts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/components/left/main/LeftMainHeader.tsx b/src/components/left/main/LeftMainHeader.tsx index 97eb792d9..333922bd1 100644 --- a/src/components/left/main/LeftMainHeader.tsx +++ b/src/components/left/main/LeftMainHeader.tsx @@ -14,6 +14,7 @@ import buildClassName from '../../../util/buildClassName'; import { formatDateToString } from '../../../util/dateFormat'; import switchTheme from '../../../util/switchTheme'; import { setPermanentWebVersion } from '../../../util/permanentWebVersion'; +import { clearWebsync } from '../../../util/websync'; import { selectTheme } from '../../../modules/selectors'; import { isChatArchived } from '../../../modules/helpers'; import useLang from '../../../hooks/useLang'; @@ -159,6 +160,7 @@ const LeftMainHeader: FC = ({ const handleSwitchToWebK = () => { setPermanentWebVersion('K'); + clearWebsync(); disableHistoryBack(); }; diff --git a/src/util/websync.ts b/src/util/websync.ts index fb2eadebc..0f5747268 100644 --- a/src/util/websync.ts +++ b/src/util/websync.ts @@ -84,3 +84,7 @@ export function startWebsync() { forceWebsync(authed); }, Math.max(0, timeout * 1000)); } + +export function clearWebsync() { + localStorage.removeItem(WEBSYNC_KEY); +}