From f9369b31f39c792e553a6a1c28bc03ffd0ae244a Mon Sep 17 00:00:00 2001 From: Steve Carlson Date: Fri, 15 Jul 2016 16:03:15 -0700 Subject: [PATCH] [issue #39] Switching from is-equal to React's shallowCompare addon --- package.json | 2 +- src/Sticky.jsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index fa2870f7..43790955 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ ], "dependencies": { "classnames": "^2.0.0", - "is-equal-shallow": "^0.1.0", + "react-addons-shallow-compare": "^0.14.2 || ^15.0.0", "subscribe-ui-event": "^1.0.0" }, "devDependencies": { diff --git a/src/Sticky.jsx b/src/Sticky.jsx index e88b07c1..94be684c 100644 --- a/src/Sticky.jsx +++ b/src/Sticky.jsx @@ -10,7 +10,7 @@ import React, {Component, PropTypes} from 'react'; import {subscribe} from 'subscribe-ui-event'; import classNames from 'classnames'; -import isEqual from 'is-equal-shallow'; +import shallowCompare from 'react-addons-shallow-compare'; // constants const STATUS_ORIGINAL = 0; // The default status, locating at the original position. @@ -355,7 +355,7 @@ class Sticky extends Component { } shouldComponentUpdate (nextProps, nextState) { - return !this.props.shouldFreeze() && (!isEqual(this.props, nextProps) || !isEqual(this.state, nextState)); + return !this.props.shouldFreeze() && shallowCompare(this, nextProps, nextState); } render () {