Skip to content
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

Implement a simple shouldComponentUpdate for DNDRoomTile #6313

Merged
merged 2 commits into from
Mar 15, 2018
Merged
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
11 changes: 11 additions & 0 deletions src/components/views/rooms/DNDRoomTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ export default class DNDRoomTile extends React.Component {
});
}

shouldComponentUpdate(nextProps, nextState) {
// Do a shallow comparison of the props that we pass through (there is no
// state to check).
// NB: We might want to ignore changes to index in future if reordering
// occurs (all indices of all tiles in the sublist will change).
if (Object.keys(nextProps).some((k) => nextProps[k] !== this.props[k])) {
return true;
}
return false;
}

render() {
const props = this.props;

Expand Down