diff --git a/src/lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx b/src/lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx index 7b1d7a00bbe06f19ff8651c34098e2e7901bccec..1394937d1daada2080f60276a37112c70d899c3e 100644 --- a/src/lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx +++ b/src/lib/vis/visualizations/nodelinkvis/components/NLPixi.tsx @@ -63,6 +63,7 @@ export const NLPixi = forwardRef((props: Props, refExternal) => { let edgeBundling: Point[][]; const ref = useRef<HTMLDivElement>(null); const canvas = useRef<HTMLCanvasElement>(null); + const appRef = useRef<Application | null>(null); const app = useAsyncMemo(async () => { if (canvas.current == null) return null; const app = new Application(); @@ -75,6 +76,7 @@ export const NLPixi = forwardRef((props: Props, refExternal) => { resolution: window.devicePixelRatio || 2, canvas: canvas.current as HTMLCanvasElement, }); + appRef.current = app; return app; }, [canvas]); @@ -961,7 +963,14 @@ export const NLPixi = forwardRef((props: Props, refExternal) => { nodeMap.current.clear(); edgeLabelMap.current.clear(); - app?.destroy(); + nodeLabelMap.current.clear(); + + appRef.current?.ticker.stop(); + appRef.current?.destroy(true, { + children: true, + texture: true, + textureSource: true, + }); const layout = layoutAlgorithm.current as GraphologyForceAtlas2Webworker; if (layout?.cleanup != null) layout.cleanup();