Repository: monkeytypegame/monkeytype (2025-08-03T12:24:49Z)

Issue:
Punctuation is lost when page is refreshed
### Did you clear cache before opening an issue?

- [x] I have cleared my cache

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Does the issue happen when logged in?

Yes

### Does the issue happen when logged out?

Yes

### Does the issue happen in incognito mode when logged in?

Yes

### Does the issue happen in incognito mode when logged out?

Yes

### Account name

_No response_

### Account config

_No response_

### Current Behavior

If I enable punctuation, f.e by clicking on button "punctuation", then refresh the page, punctuation is disabled. All other configs are retained (f.e change time from 30 to 60 and refresh, etc).

### Expected Behavior

Should retain punctuation. Was working couple weeks ago like this.

### Steps To Reproduce

1. Open https://monkeytype.com/
2. Click on punctuation
3. Hit page refresh (F5)

### Environment

- OS: Linux/Windows
- Browser: Edge/Firefox
- Browser Version: (only have Edge ATM) - 137.0.3296.68



### Anything else?

I do see that "config" in local storage changes to `"punctuation": true` when I enable it, but refreshing the page changes that back to false. The same happens with "numbers".

I take it that these values are both booleans and javascript has a nasty habit of transforming "undefined" and "null" into boolean as `false` without being told. I'd assume that at some point there is a bit of code that reads configs from db or url or somewhere else where neither "punctuation" nor "numbers" are saved and then transforms their values to false and uses that for test (and storing to local storage).


Discussion:

Patch:
diff --git a/frontend/src/ts/config.ts b/frontend/src/ts/config.ts
index d2ac943ddb8d..1e1208767768 100644
--- a/frontend/src/ts/config.ts
+++ b/frontend/src/ts/config.ts
@@ -810,12 +810,12 @@ const lastConfigsToApply: Set<keyof Config> = new Set([
   "minAcc",
   "minBurst",
   "paceCaret",
-  "punctuation",
+  "quoteLength", //quote length sets mode,
+  "words",
+  "mode", // mode sets punctuation and numbers
   "numbers",
-  "quoteLength",
+  "punctuation",
   "time",
-  "words",
-  "mode",
   "funbox",
 ]);
 


Test patch:
diff --git a/frontend/__tests__/root/config.spec.ts b/frontend/__tests__/root/config.spec.ts
index a8ff3ed3c4db..0096cf312a69 100644
--- a/frontend/__tests__/root/config.spec.ts
+++ b/frontend/__tests__/root/config.spec.ts
@@ -1163,9 +1163,20 @@ describe("Config", () => {
         expected: Partial<ConfigType>;
       }[] = [
         {
-          display: "quote length shouldnt override mode",
-          value: { quoteLength: [0], mode: "time" },
-          expected: { quoteLength: [0], mode: "time" },
+          display:
+            "quote length shouldnt override mode, punctuation and numbers",
+          value: {
+            punctuation: true,
+            numbers: true,
+            quoteLength: [0],
+            mode: "time",
+          },
+          expected: {
+            punctuation: true,
+            numbers: true,
+            quoteLength: [0],
+            mode: "time",
+          },
         },
       ];