Skip to content

Commit

Permalink
Merge pull request #49 from yahoo/issue39
Browse files Browse the repository at this point in the history
[issue #39] Switching from is-equal-shallow to React's shallowCompare addon
  • Loading branch information
src-code authored Jul 18, 2016
2 parents 7eb1382 + f9369b3 commit ec37e74
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions src/Sticky.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -357,7 +357,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 () {
Expand Down

0 comments on commit ec37e74

Please sign in to comment.