Skip to content

Commit

Permalink
Merge pull request #19514 from apache/fix/graph-dispose
Browse files Browse the repository at this point in the history
fix(graph): fix force layout iteration timer doesn't stop after disposing the chart
  • Loading branch information
Ovilia authored Jan 16, 2024
2 parents 94dd855 + 690ebe6 commit 6cae00c
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/chart/graph/GraphView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ class GraphView extends ChartView {
}

dispose() {
this.remove();

this._controller && this._controller.dispose();
this._controllerHost = null;
}
Expand Down Expand Up @@ -300,7 +302,11 @@ class GraphView extends ChartView {
this._lineDraw.updateLayout();
}

remove(ecModel: GlobalModel, api: ExtensionAPI) {
remove() {
clearTimeout(this._layoutTimeout);
this._layouting = false;
this._layoutTimeout = null;

this._symbolDraw && this._symbolDraw.remove();
this._lineDraw && this._lineDraw.remove();
}
Expand Down
57 changes: 56 additions & 1 deletion test/graph-case.html

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

2 changes: 1 addition & 1 deletion test/runTest/actions/__meta__.json

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

2 changes: 1 addition & 1 deletion test/runTest/actions/graph-case.json

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

0 comments on commit 6cae00c

Please sign in to comment.