1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-04-21 22:02:05 +02:00

Merge pull request #438 from ianstormtaylor/remove-immutable-is

remove Immutable.is check in node shouldComponentUpdate
This commit is contained in:
Ian Storm Taylor 2016-11-18 13:40:48 -08:00 committed by GitHub
commit 25f09ecc41

View File

@ -99,13 +99,14 @@ class Node extends React.Component {
return true
}
// If the node has changed, update.
// If the node has changed, update. PERF: There are certain cases where the
// node instance will have changed, but it's properties will be exactly the
// same (copy-paste, delete backwards, etc.) in which case this will not
// catch a potentially avoidable re-render. But those cases are rare enough
// that they aren't really a drag on performance, so for simplicity we just
// let them through.
if (nextProps.node != this.props.node) {
if (!IS_DEV || !Immutable.is(nextProps.node, this.props.node)) {
return true
} else {
warn('A new immutable Node instance was encountered with an identical structure to the previous instance. This is usually a mistake and can impact performance. Make sure to preserve immutable references when nothing has changed. The node in question was:', nextProps.node)
}
return true
}
const nextHasEdgeIn = nextProps.state.selection.hasEdgeIn(nextProps.node)