Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions MultiSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ class MultiSelect extends Component {
}
}

shouldComponentUpdate(nextProps) {
shouldComponentUpdate(nextProps, nextState) {
// This is a performance check as this sometimes gets updated often
if (nextProps.selectedOptions.length === this.props.selectedOptions.length) {
if (nextProps.selectedOptions === this.props.selectedOptions &&
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make this if look like this please:

if (
  (variable === variable) &&
  (varible1 === variable1)
) {
  // do things here
}

I prefer this more verbose option for multiline stuff

nextState.selectedRows === this.state.selectedRows) {
return false;
}

return true;
}

Expand Down