-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Description
Copy of #572 since there seemed to be a misunderstanding of the core issue there. The desire here is to be able to set options that look like this:
var options = [
{label: 'item 1', value: {id: 123, foo: 'bar'},
{label: 'item 2', value: {id: 456, foo: 'baz'}
]
The reason this doesn't work currently is because of how this.props.value is interpreted to display the selected option.
- Values that aren't strings or numbers aren't handled:
Line 423 in 46ca406
if (typeof value !== 'string' && typeof value !== 'number') return value; - Even if they were,
===is not sufficient for comparing objects:Line 427 in 46ca406
if (options[i][valueKey] === value) return options[i];
Is setting values to objects a feature react-select is interested in supporting? If so, would it be okay to add a dependency on an object deep equality checker like node-deep-equal?
AntoBrajkovic, amir-hadzic, dearlordylord, jedu0309, yoshiko-pg and 14 more