Skip to content

Commit f2b1d89

Browse files
move layout to only trigger during react lifecycle
1 parent 721e6c6 commit f2b1d89

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/DagreReact.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ export default class DagreReact extends React.Component<
162162

163163
checkRender() {
164164
if (this.state.graph.layoutIfSized()) {
165+
this.forceUpdate();
166+
}
167+
}
168+
169+
componentDidUpdate() {
170+
if (this.state.graph.dirty) {
165171
// console.log("Forcing an update");
166172
this.state.graph.layout();
167173
this.adjustIntersections();

0 commit comments

Comments
 (0)