Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/component/tooltip/TooltipRichContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ class TooltipRichContent {
}

dispose() {
// Keep it consistent with `TooltipHTMLContent#dispose`, so that a pending
// `hideDelay` timer does not outlive the disposed chart.
clearTimeout(this._hideTimeout);
this._zr.remove(this.el);
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/component/tooltip/TooltipView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,13 @@ class TooltipView extends ComponentView {
}

dispose(ecModel: GlobalModel, api: ExtensionAPI) {
// The pending timers must be cleared before the early return below, and
// before the members they rely on are reset to null. Otherwise a delayed
// callback (scheduled by `tooltip.showDelay` or by a refresh) would run
// against a disposed view and throw.
clearTimeout(this._showTimout);
clearTimeout(this._refreshUpdateTimeout);

if (env.node || !api.getDom()) {
return;
}
Expand Down
91 changes: 91 additions & 0 deletions test/ut/spec/component/tooltip/dispose.test.ts

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