Clear websync setting before switching to another web version

This commit is contained in:
Alexander Zinchuk 2022-01-13 15:06:30 +01:00
parent b393b3cad1
commit d3dbeffb87
2 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import buildClassName from '../../../util/buildClassName';
import { formatDateToString } from '../../../util/dateFormat'; import { formatDateToString } from '../../../util/dateFormat';
import switchTheme from '../../../util/switchTheme'; import switchTheme from '../../../util/switchTheme';
import { setPermanentWebVersion } from '../../../util/permanentWebVersion'; import { setPermanentWebVersion } from '../../../util/permanentWebVersion';
import { clearWebsync } from '../../../util/websync';
import { selectTheme } from '../../../modules/selectors'; import { selectTheme } from '../../../modules/selectors';
import { isChatArchived } from '../../../modules/helpers'; import { isChatArchived } from '../../../modules/helpers';
import useLang from '../../../hooks/useLang'; import useLang from '../../../hooks/useLang';
@ -159,6 +160,7 @@ const LeftMainHeader: FC<OwnProps & StateProps> = ({
const handleSwitchToWebK = () => { const handleSwitchToWebK = () => {
setPermanentWebVersion('K'); setPermanentWebVersion('K');
clearWebsync();
disableHistoryBack(); disableHistoryBack();
}; };

View File

@ -84,3 +84,7 @@ export function startWebsync() {
forceWebsync(authed); forceWebsync(authed);
}, Math.max(0, timeout * 1000)); }, Math.max(0, timeout * 1000));
} }
export function clearWebsync() {
localStorage.removeItem(WEBSYNC_KEY);
}