Skip to content

[SelectField] Object as value fails equality check #5818

@patrickml

Description

@patrickml

Working with the Select field which states that the value can be any kind does not work properly with objects. The onChange will produce the correct result, but trying to set value = to an object will fail when selecting the value.

Example

<SelectField value={{ foo: 'bar' }}>
  <MenuItem value={{ foo: 'bar' }} primaryText={p.key} label={p.key} />
</SelectField>

The issue seems to come from here https://github.com/callemall/material-ui/blob/master/src/DropDownMenu/DropDownMenu.js#L297 where just a normal equality check is used.

Possible solution is to check type of and if it is object then stringify the values

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions