Skip to content

Commit

Permalink
[Select] onChange fired with current value
Browse files Browse the repository at this point in the history
  • Loading branch information
ksrb committed Mar 31, 2020
1 parent 5aad5f2 commit 11d3452
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/material-ui/src/Select/Select.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ describe('<Select />', () => {
it('should get selected element from arguments', () => {
const onChangeHandler = spy();
const { getAllByRole, getByRole } = render(
<Select onChange={onChangeHandler} value="1">
<Select onChange={onChangeHandler} value="0">
<MenuItem value="0" />
<MenuItem value="1" />
<MenuItem value="2" />
Expand Down
4 changes: 4 additions & 0 deletions packages/material-ui/src/Select/SelectInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ const SelectInput = React.forwardRef(function SelectInput(props, ref) {
newValue = child.props.value;
}

if (value === newValue) {
return;
}

setValue(newValue);

if (onChange) {
Expand Down

0 comments on commit 11d3452

Please sign in to comment.