Skip to content

Commit

Permalink
move layout to only trigger during react lifecycle
Browse files Browse the repository at this point in the history
  • Loading branch information
bobthekingofegypt committed Mar 12, 2021
1 parent 721e6c6 commit f2b1d89
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/DagreReact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ export default class DagreReact extends React.Component<

checkRender() {
if (this.state.graph.layoutIfSized()) {
this.forceUpdate();
}
}

componentDidUpdate() {
if (this.state.graph.dirty) {
// console.log("Forcing an update");
this.state.graph.layout();
this.adjustIntersections();
Expand Down

0 comments on commit f2b1d89

Please sign in to comment.