Skip to content

fix(settings): move blur-triggered save out of field validators (@fehmer) - #8589

Open
fehmer wants to merge 1 commit into
masterfrom
feature/fix-validation-loop
Open

fehmer wants to merge 1 commit into
masterfrom
feature/fix-validation-loop

Conversation

@fehmer

@fehmer fehmer commented Nov 15, 2026

Copy link
Copy Markdown
Member

Closes #8588

Summary

These settings saved on blur via a field validator (validators.onBlur → form.handleSubmit()). TanStack Form's submit-event validation re-runs the onChange, onBlur and onSubmit validators, so handleSubmit() re-triggered its own validation — an infinite microtask loop that never yields the main thread (the tab freeze in #8588).

The save now lives in the input's blur handler, not a validator, so submit validation can't re-run it:

 InputField (ui/form)
   <input onBlur>
     reset to default if empty
     field.handleBlur()
-    validators.onBlur → form.handleSubmit()  ← re-run by submit validation → loop
+    form.handleSubmit()  ← when submitOnBlur (DOM event, not validation)

Affected inputs, all converted to submitOnBlur: min accuracy, min speed, min burst, pace caret, max line width, custom background, and SearchableAutoSetting's number branch (covers fontSize/tapeMargin — the issue notes the same pattern was in the bundle for these).

Enter still saves through the form's implicit submit; blur saves without re-entering validation. New InputField behaviour is covered by two tests (submits after handleBlur when submitOnBlur; does not submit by default).

Evidence

  • Before: Settings page freezes (infinite loop) on blur/Enter in the min accuracy input #8588 — focusing the min accuracy input then pressing Enter or clicking away froze the tab permanently (watchdog stack: _handleSubmit → validateAllFields → …).
    After: dev server, settings page, real interactions on min accuracy (click + Enter; fill + click away) and on fontSize: a follow-up Runtime.evaluate returns promptly after each action (a live loop would starve even synchronous evaluates), so the page stays responsive; changed values saved (minAccCustom 55, min speed 101, both flipped to custom).
  • InputField spec: 28/28. Full frontend suite: 1849/1849. oxlint --type-aware --type-check: clean.

Merge Danger

Door: two-way — small local behaviour move; reverting the commit restores the old (frozen) behaviour, no data or API change.

Blast Radius: settings-page inputs only. A regression would mean these inputs stop saving on blur (or the freeze returns); no other page passes submitOnBlur.

@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend User interface or web stuff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Settings page freezes (infinite loop) on blur/Enter in the min accuracy input

2 participants