-
Notifications
You must be signed in to change notification settings - Fork 47.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore symbols and functions in select tag #13389
Changes from 3 commits
1d2755a
a6041eb
81ff1c9
48dcdef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,8 @@ import {getCurrentFiberOwnerNameInDevOrNull} from 'react-reconciler/src/ReactCur | |
import warning from 'shared/warning'; | ||
|
||
import ReactControlledValuePropTypes from '../shared/ReactControlledValuePropTypes'; | ||
import {getToStringValue, toString} from './ToStringValue'; | ||
import type {ToStringValue} from './ToStringValue'; | ||
|
||
let didWarnValueDefaultValue; | ||
|
||
|
@@ -21,7 +23,7 @@ if (__DEV__) { | |
|
||
type SelectWithWrapperState = HTMLSelectElement & { | ||
_wrapperState: { | ||
initialValue: ?string, | ||
initialValue: ?ToStringValue, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's curious that this is nullable and it's not clear to me where Not important for this PR, but I can't help but wonder if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good point. I'll try and play around with it and see what I find out 🙂Feel free to report an issue, regardless. |
||
wasMultiple: boolean, | ||
}, | ||
}; | ||
|
@@ -98,7 +100,7 @@ function updateOptions( | |
} else { | ||
// Do not set `select.value` as exact behavior isn't consistent across all | ||
// browsers for all cases. | ||
let selectedValue = '' + (propValue: string); | ||
let selectedValue = toString(getToStringValue((propValue: any))); | ||
let defaultSelected = null; | ||
for (let i = 0; i < options.length; i++) { | ||
if (options[i].value === selectedValue) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style nit: but I think the implicit return with an assignment distracts from the test. Could you remove them, like: