Skip to content

Commit 04b1678

Browse files
committed
Implement a simple shouldComponentUpdate for DNDRoomTile
because otherwise beautiful dnd spends a lot of time requesting animation frames pointlessly.
1 parent 74b4532 commit 04b1678

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎src/components/views/rooms/DNDRoomTile.js‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ export default class DNDRoomTile extends React.Component {
3333
});
3434
}
3535

36+
shouldComponentUpdate(nextProps, nextState) {
37+
// Do a shallow comparison of the props that we pass through (there is no
38+
// state to check).
39+
// NB: We might want to ignore changes to index in future if reordering
40+
// occurs (all indices of all tiles in the sublist will change).
41+
if (Object.keys(nextProps).some((k) => nextProps[k] !== this.props[k])) {
42+
return true;
43+
}
44+
return false;
45+
}
46+
3647
render() {
3748
const props = this.props;
3849

0 commit comments

Comments
 (0)