fix(devtools): stop zoom transition when disposing the tree visualizer

Snapping to a node starts a 500ms d3 zoom transition that was not
interrupted on dispose. If the tree visualizer is destroyed mid-transition,
d3-zoom keeps reading the size of the now detached SVG and throws
`NotSupportedError: Failed to read the 'value' property from 'SVGLength'`.

Interrupt any running transition in `dispose()`.

Tested with the router tree spec running zoneless (next commit), which fails
with the error above without this change.
This commit is contained in:
Shuaib Hasan Akib
2026-11-12 08:15:51 -08:00
committed by Jessica Janiuk
parent 8be02a66d3
commit 242efd110f
@@ -144,6 +144,7 @@ export class TreeVisualizer<T extends TreeNode = TreeNode> extends GraphRenderer
override dispose(): void {
super.dispose();
d3.select(this.containerElement).interrupt();
this.snappedNodeListenersDisposeFn?.();
}