Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Improvement/named exports #380

Merged
merged 25 commits into from
Jun 5, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use react-fast-compare@2.0.0 and remove sCU except on primitive compo…
…nents
  • Loading branch information
boygirl committed Jun 5, 2018
commit df4132e7a42b1eba35b7bde56841967f83e3026a
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"d3-shape": "^1.2.0",
"d3-timer": "^1.0.0",
"lodash": "^4.17.5",
"react-fast-compare": "^1.0.0"
"react-fast-compare": "^2.0.0"
},
"devDependencies": {
"builder-victory-component-dev": "^5.1.2",
Expand Down
25 changes: 2 additions & 23 deletions src/victory-util/add-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,8 @@ export default (WrappedComponent, options) => {
}
}

shouldComponentUpdate(nextProps) {
const calculatedValues = this.getCalculatedValues(nextProps);
// re-render without additional checks when component is animated
if (this.props.animate || this.props.animating) {
this.cacheValues(calculatedValues);
return true;
}

// check for any state changes triggered by events or shared events
const calculatedState = this.getStateChanges(nextProps, calculatedValues);
if (!Collection.areVictoryPropsEqual(this.calculatedState, calculatedState)) {
this.cacheValues(calculatedValues);
this.calculatedState = calculatedState;
return true;
}

// check whether props have changed
if (!Collection.areVictoryPropsEqual(this.props, nextProps)) {
this.cacheValues(calculatedValues);
return true;
}

return false;
componentWillReceiveProps(nextProps) {
this.cacheValues(this.getCalculatedValues(nextProps));
}

applyExternalMutations(props, externalMutations) {
Expand Down