mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-18 13:11:17 +02:00
remove Immutable.is check in node shouldComponentUpdate
This commit is contained in:
@@ -99,13 +99,13 @@ class Node extends React.Component {
|
|||||||
return true
|
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 should be much
|
||||||
|
// rarer than trying to deeply evaluate any changes in all nodes.
|
||||||
if (nextProps.node != this.props.node) {
|
if (nextProps.node != this.props.node) {
|
||||||
if (!IS_DEV || !Immutable.is(nextProps.node, this.props.node)) {
|
|
||||||
return true
|
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const nextHasEdgeIn = nextProps.state.selection.hasEdgeIn(nextProps.node)
|
const nextHasEdgeIn = nextProps.state.selection.hasEdgeIn(nextProps.node)
|
||||||
|
Reference in New Issue
Block a user