From 6a5a7f37b285ea2ce5058e84eb4664ccfbad5938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Thu, 27 Oct 2016 10:17:08 +0200 Subject: [PATCH] Add warning log when references are different in shouldComponentUpdate(Fix #373) --- src/components/node.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/node.js b/src/components/node.js index fd1edde1b..0b1f987b4 100644 --- a/src/components/node.js +++ b/src/components/node.js @@ -1,4 +1,5 @@ +import Immutable from 'immutable' import Base64 from '../serializers/base-64' import Debug from 'debug' import React from 'react' @@ -7,6 +8,7 @@ import TYPES from '../constants/types' import Leaf from './leaf' import Void from './void' import scrollTo from '../utils/scroll-to' +import warning from '../utils/warning' /** * Debug. @@ -97,7 +99,10 @@ class Node extends React.Component { } // If the node has changed, update. - if (props.node != this.props.node) { + if (Immutable.is(props.node, this.props.node)) { + if (props.node != this.props.node) { + warning('Encountered different references for identical node values in "shouldComponentUpdate". Check that you are preserving references') + } return true }