mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-09 00:36:41 +02:00
Merge pull request #438 from ianstormtaylor/remove-immutable-is
remove Immutable.is check in node shouldComponentUpdate
This commit is contained in:
@@ -99,13 +99,14 @@ 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 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 (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