Skip to content

Commit de4e872

Browse files
authored
fix(lazy-mode): Save lazy mode in local storage after getting not supported message (@Leonabcd123) (monkeytypegame#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.
1 parent 6d8ef91 commit de4e872

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

frontend/src/ts/test/test-logic.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ export function restart(options = {} as RestartOptions): void {
400400

401401
let lastInitError: Error | null = null;
402402
let rememberLazyMode: boolean;
403+
let showedLazyModeNotification: boolean = false;
403404
let testReinitCount = 0;
404405

405406
async function init(): Promise<boolean> {
@@ -494,18 +495,20 @@ async function init(): Promise<boolean> {
494495
important: true,
495496
},
496497
);
497-
UpdateConfig.setLazyMode(false, true);
498+
UpdateConfig.setLazyMode(false, false);
498499
} else if (rememberLazyMode && anySupportsLazyMode) {
499500
UpdateConfig.setLazyMode(true, true);
500501
}
501502
} else {
502503
// normal mode
503504
if (Config.lazyMode && !allowLazyMode) {
504505
rememberLazyMode = true;
506+
showedLazyModeNotification = true;
505507
Notifications.add("This language does not support lazy mode.", 0, {
506508
important: true,
507509
});
508-
UpdateConfig.setLazyMode(false, true);
510+
511+
UpdateConfig.setLazyMode(false, false);
509512
} else if (rememberLazyMode && !language.noLazyMode) {
510513
UpdateConfig.setLazyMode(true, true);
511514
}
@@ -1627,7 +1630,10 @@ ConfigEvent.subscribe((eventKey, eventValue, nosave) => {
16271630
ArabicLazyMode.set(eventValue as boolean);
16281631
}
16291632
if (eventValue === false) {
1630-
rememberLazyMode = false;
1633+
if (!showedLazyModeNotification) {
1634+
rememberLazyMode = false;
1635+
}
1636+
showedLazyModeNotification = false;
16311637
}
16321638
}
16331639
});

0 commit comments

Comments
 (0)