You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
App configuration fields of type number only allow inputting numeric values. However, if the user clears the field and clicks submit, Devvit silently sets the value to 0 without any indication. The user would not see this change unless they refresh the settings page.
For the app developer, this is impossible to handle when 0 is a valid value for the field. This breaks using input validation to make a field required since event.value = 0.
Potential Fix
settings.get() and settings.getAll() suggest that undefined is a valid value for settings:
Devvit should set fields of type number equal to undefined when the submitted field was empty. This will allow for using input validation to require the field when 0 is a valid value for the field.
The text was updated successfully, but these errors were encountered:
Info
App configuration fields of type
number
only allow inputting numeric values. However, if the user clears the field and clicks submit, Devvit silently sets the value to0
without any indication. The user would not see this change unless they refresh the settings page.For the app developer, this is impossible to handle when
0
is a valid value for the field. This breaks using input validation to make a field required sinceevent.value = 0
.Potential Fix
settings.get()
andsettings.getAll()
suggest thatundefined
is a valid value for settings:devvit/packages/public-api/src/types/settings.ts
Line 58 in 8ca9b5e
devvit/packages/public-api/src/types/settings.ts
Line 46 in 8ca9b5e
Devvit should set fields of type
number
equal toundefined
when the submitted field was empty. This will allow for using input validation to require the field when0
is a valid value for the field.The text was updated successfully, but these errors were encountered: