@@ -30,19 +30,21 @@ export default class Node extends React.Component {
3030 }
3131
3232 componentWillUpdate ( nextProps ) {
33- const shouldTransform = this . shouldNodeTransform ( this . props , nextProps ) ;
34- if ( shouldTransform ) {
35- const transform = this . setTransformOrientation (
36- nextProps . nodeData . x ,
37- nextProps . nodeData . y ,
38- nextProps . orientation ,
39- ) ;
40- this . applyTransform ( transform , nextProps . transitionDuration ) ;
41- }
33+ const transform = this . setTransformOrientation (
34+ nextProps . nodeData . x ,
35+ nextProps . nodeData . y ,
36+ nextProps . orientation ,
37+ ) ;
38+ this . applyTransform ( transform , nextProps . transitionDuration ) ;
39+ }
40+
41+ shouldComponentUpdate ( nextProps ) {
42+ return this . shouldNodeTransform ( this . props , nextProps ) ;
4243 }
4344
4445 shouldNodeTransform ( ownProps , nextProps ) {
4546 return (
47+ nextProps . subscriptions !== ownProps . subscriptions ||
4648 nextProps . nodeData . x !== ownProps . nodeData . x ||
4749 nextProps . nodeData . y !== ownProps . nodeData . y ||
4850 nextProps . orientation !== ownProps . orientation
@@ -161,6 +163,7 @@ Node.propTypes = {
161163 name : PropTypes . string . isRequired ,
162164 attributes : PropTypes . object ,
163165 textLayout : PropTypes . object . isRequired ,
166+ subscriptions : PropTypes . object . isRequired , // eslint-disable-line react/no-unused-prop-types
164167 circleRadius : PropTypes . number ,
165168 styles : PropTypes . object ,
166169} ;
0 commit comments