Skip to content

fix: reset animation fps limit to native when custom field is cleared on blur#8129

Closed
klfk wants to merge 1 commit into
monkeytypegame:masterfrom
klfk:fix/animation-fps-limit-reset-on-blur
Closed

fix: reset animation fps limit to native when custom field is cleared on blur#8129
klfk wants to merge 1 commit into
monkeytypegame:masterfrom
klfk:fix/animation-fps-limit-reset-on-blur

Conversation

@klfk

@klfk klfk commented Jun 17, 2026

Copy link
Copy Markdown

Description

Fixes #8119

Problem

When a user set a custom animation fps limit (e.g. 60), then cleared the input field and clicked away, nothing happened — the native button stayed inactive, the field stayed empty, and the previous custom value was still in effect (no visual feedback).

Root cause: The onBlur validator called form.handleSubmit() with an empty string, which failed the onChange validator ("Must be a number"), so onSubmit was never called. The resetToDefaultIfEmptyOnBlur prop had no effect because the form's defaultValues.fpsLimit was "" — already empty.

Fix

In the onBlur validator, explicitly detect an empty value and call setfpsLimit(1000) to reset to native, making the native button active and clearing the indicator — which matches the expected behavior described in the issue.

// Before
onBlur: () => {
  void form.handleSubmit();
},

// After
onBlur: ({ value }) => {
  if (String(value) === "") {
    setfpsLimit(1000);
    form.setFieldValue("fpsLimit", "");
    savedIndicator.hide();
    return;
  }
  void form.handleSubmit();
},

Also removed the now-redundant resetToDefaultIfEmptyOnBlur prop from <InputField> since blur is handled manually.

Testing

  1. Go to Settings → search animation fps limit
  2. Enter 60 in the custom limit field → click away → ✅ saved indicator flashes, native button inactive
  3. Clear the field → click away → ✅ native button becomes active, field stays empty

When a user entered a custom fps limit (e.g. 60), then cleared the
field and clicked away, the setting was not updated — the field stayed
empty and the 'native' button remained inactive.

Root cause: the onBlur validator called form.handleSubmit() with an
empty value, which failed validation ('Must be a number') and silently
did nothing. resetToDefaultIfEmptyOnBlur had no effect because the
form's defaultValues.fpsLimit was already "".

Fix: detect an empty value in onBlur and explicitly reset to native
(fpsLimit = 1000), making the 'native' button go active — which matches
the expected behavior described in the issue.

Fixes monkeytypegame#8119
@github-actions

Copy link
Copy Markdown
Contributor

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and also include the author name at the end inside parenthesis. It looks like your proposed title needs to be adjusted.

Details:

Title "fix: reset animation fps limit to native when custom field is cleared on blur"
didn't match the configured pattern. Please ensure that the title
contains your name so that you can be credited in our changelog.

A correct version would look something like:

feat: add new feature (@github_username)
impr(quotes): add english quotes (@username)
fix(leaderboard): show user rank correctly (@user1, @user2, @user3)

@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Jun 17, 2026
@fehmer

fehmer commented Jun 17, 2026

Copy link
Copy Markdown
Member

If the stored value was 60 shouldn't it reset to 60 on empty input.
In addition the field should not be marked with an error if the user clicks on native:
image

@fehmer

fehmer commented Jun 18, 2026

Copy link
Copy Markdown
Member

duplicate #8130

@fehmer fehmer closed this Jun 18, 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.

Animation fps limit setting doesn't reset on blur

3 participants