mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-29 11:26:13 +08:00
fix(lazy-mode): Save lazy mode in local storage after getting not supported message (@Leonabcd123) (#7171)
### Description Save lazy mode status in local storage after getting the "This language does not support lazy mode" message. This is so the user doesn't get the same message every time they refresh, and it matches up with the settings that show that lazy mode is disabled even though it's enabled in local storage.
This commit is contained in:
parent
6d8ef91155
commit
de4e872996
1 changed files with 9 additions and 3 deletions
|
|
@ -400,6 +400,7 @@ export function restart(options = {} as RestartOptions): void {
|
|||
|
||||
let lastInitError: Error | null = null;
|
||||
let rememberLazyMode: boolean;
|
||||
let showedLazyModeNotification: boolean = false;
|
||||
let testReinitCount = 0;
|
||||
|
||||
async function init(): Promise<boolean> {
|
||||
|
|
@ -494,7 +495,7 @@ async function init(): Promise<boolean> {
|
|||
important: true,
|
||||
},
|
||||
);
|
||||
UpdateConfig.setLazyMode(false, true);
|
||||
UpdateConfig.setLazyMode(false, false);
|
||||
} else if (rememberLazyMode && anySupportsLazyMode) {
|
||||
UpdateConfig.setLazyMode(true, true);
|
||||
}
|
||||
|
|
@ -502,10 +503,12 @@ async function init(): Promise<boolean> {
|
|||
// normal mode
|
||||
if (Config.lazyMode && !allowLazyMode) {
|
||||
rememberLazyMode = true;
|
||||
showedLazyModeNotification = true;
|
||||
Notifications.add("This language does not support lazy mode.", 0, {
|
||||
important: true,
|
||||
});
|
||||
UpdateConfig.setLazyMode(false, true);
|
||||
|
||||
UpdateConfig.setLazyMode(false, false);
|
||||
} else if (rememberLazyMode && !language.noLazyMode) {
|
||||
UpdateConfig.setLazyMode(true, true);
|
||||
}
|
||||
|
|
@ -1627,7 +1630,10 @@ ConfigEvent.subscribe((eventKey, eventValue, nosave) => {
|
|||
ArabicLazyMode.set(eventValue as boolean);
|
||||
}
|
||||
if (eventValue === false) {
|
||||
rememberLazyMode = false;
|
||||
if (!showedLazyModeNotification) {
|
||||
rememberLazyMode = false;
|
||||
}
|
||||
showedLazyModeNotification = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue