Skip to content

Commit 004261d

Browse files
authored
Merge pull request #24 from magjac/response-time
Don't re-render the graph when the DOT source is unchanged
2 parents 8b29d05 + d0c44e9 commit 004261d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Graph.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class Graph extends React.Component {
4949
this.pendingUpdate = false;
5050
this.rendering = false;
5151
this.prevFit = null;
52+
this.prevDotSrc = '';
5253
}
5354

5455
componentDidMount() {
@@ -90,6 +91,9 @@ class Graph extends React.Component {
9091
if (this.props.dotSrc.length === 0) {
9192
return;
9293
}
94+
if (this.props.dotSrc === this.prevDotSrc) {
95+
return;
96+
}
9397
if (this.rendering) {
9498
this.pendingUpdate = true;
9599
return;
@@ -106,6 +110,7 @@ class Graph extends React.Component {
106110
}
107111
this.prevFit = this.props.fit;
108112
}
113+
this.prevDotSrc = this.props.dotSrc;
109114
this.rendering = true;
110115
this.graphviz
111116
.width(width)

0 commit comments

Comments
 (0)