Did you clear cache before opening an issue?
Is there an existing issue for this?
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
When the animation fps limit setting it set to native, an invalid value is entered in the field below, and the field is blurred, the invalid value remains and isn't emptied.
Expected Behavior
Field should empty on blur if an invalid value has been entered and the current value is native.
Steps To Reproduce
- Go to https://monkeytype.com/settings?highlight=animationFpsLimit
- Click on
native
- In the field below it, enter
asdf
- Click outside of the field
- Notice how
asdf remains in the field
Environment
- OS: Arch Linux
- Browser: Firefox
- Browser Version: 151.0.4
Anything else?
A very brief summary of my debugging attempt:
When the attribute list of an element contains spreads:
|
{...getNumberOptions(props.schema)} |
|
{...getDateOptions(props.schema, formatDate)} |
solidjs compiles the code differently, causing it to use the spread function, rather than using direct assignment via effect. When using spread, it will only write to the dom (element.value = ...) if the return value of convertValueToString changes, rather than writing whenever props.field().state.value changes. In the case of our animation fps limit setting, typing asdf will set props.field().state.value to undefined (which gets converted to an empty string by convertValueToString:
|
if (input === undefined || input === null) return ""; |
And when we reset on blur, we reset to the default value which is also an empty string. The value hasn't changed, so solid doesn't write to the dom and as a result the invalid value isn't removed.
Did you clear cache before opening an issue?
Is there an existing issue for this?
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
When the animation fps limit setting it set to
native, an invalid value is entered in the field below, and the field is blurred, the invalid value remains and isn't emptied.Expected Behavior
Field should empty on blur if an invalid value has been entered and the current value is
native.Steps To Reproduce
nativeasdfasdfremains in the fieldEnvironment
Anything else?
A very brief summary of my debugging attempt:
When the attribute list of an element contains spreads:
monkeytype/frontend/src/ts/components/ui/form/InputField.tsx
Lines 107 to 108 in d7eb4b7
solidjs compiles the code differently, causing it to use the
spreadfunction, rather than using direct assignment viaeffect. When usingspread, it will only write to the dom (element.value = ...) if the return value ofconvertValueToStringchanges, rather than writing wheneverprops.field().state.valuechanges. In the case of our animation fps limit setting, typingasdfwill setprops.field().state.valueto undefined (which gets converted to an empty string byconvertValueToString:monkeytype/frontend/src/ts/components/ui/form/InputField.tsx
Line 161 in d7eb4b7
And when we reset on blur, we reset to the default value which is also an empty string. The value hasn't changed, so solid doesn't write to the dom and as a result the invalid value isn't removed.