Implement a simple shouldComponentUpdate for DNDRoomTile
because otherwise beautiful dnd spends a lot of time requesting animation frames pointlessly.
This commit is contained in:
parent
74b45322b2
commit
04b1678c7f
1 changed files with 11 additions and 0 deletions
|
@ -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() {
|
render() {
|
||||||
const props = this.props;
|
const props = this.props;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue