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
In the same vein as #3554, the useTextField hook passes along undefined as the value for value when a value isn't supplied. This causes trouble when submitting forms as GET requests (especially) because it creates searchParam soup in the URL.
🤔 Expected Behavior
If no value is passed to an input, no value attribute should exist in the DOM.
An empty input shouldn't change the searchParams when submitting a GET request in a form
😯 Current Behavior
All inputs created using useTextField have value attributes in the DOM, even when they aren't passed one.
Empty inputs add searchParams to the URL like ?emptyInputName=
💁 Possible Solution
Fix is using the same method as checkboxes were recently fixed.
🐛 Bug Report
In the same vein as #3554, the
useTextField
hook passes alongundefined
as the value forvalue
when avalue
isn't supplied. This causes trouble when submitting forms asGET
requests (especially) because it createssearchParam
soup in the URL.🤔 Expected Behavior
value
is passed to aninput
, novalue
attribute should exist in the DOM.searchParams
when submitting aGET
request in a form😯 Current Behavior
useTextField
havevalue
attributes in the DOM, even when they aren't passed one.searchParams
to the URL like?emptyInputName=
💁 Possible Solution
Fix is using the same method as checkboxes were recently fixed.
#3554
🔦 Context
I'm trying to create a search filter and the all inputs are submitting empty strings—creating entries for each in the
searchParams
.💻 Code Sample
https://codesandbox.io/s/naughty-fast-jg5wp3?file=/src/App.js
If you remove the
inputProps
from theinput
, the unnecessaryvalue
attribute goes away.🌍 Your Environment
🧢 Your Company/Team
Splink Inc.
The text was updated successfully, but these errors were encountered: