Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2742d0b

Browse files
shallow equality check before Plotly.react (#55)
1 parent f437fd7 commit 2742d0b

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

‎src/factory.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ export default function plotComponentFactory(Plotly) {
6666
this.handleUpdateWithProps = this.handleUpdateWithProps.bind(this);
6767
}
6868

69-
shouldComponentUpdate(nextProps) {
70-
return (
71-
nextProps.revision === void 0 ||
72-
nextProps.revision !== this.props.revision
73-
);
74-
}
75-
7669
componentDidMount() {
7770
this.p = this.p
7871
.then(() => {
@@ -96,6 +89,17 @@ export default function plotComponentFactory(Plotly) {
9689
}
9790

9891
componentWillUpdate(nextProps) {
92+
if (
93+
(nextProps.revision !== void 0 &&
94+
nextProps.revision === this.props.revision) ||
95+
(nextProps.layout === this.props.layout &&
96+
nextProps.data === this.props.data &&
97+
nextProps.config === this.props.config &&
98+
nextProps.frames === this.props.frames)
99+
) {
100+
return;
101+
}
102+
99103
this.p = this.p
100104
.then(() => {
101105
if (hasReactAPIMethod) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /