From 7cd20cb76baecc3e03eeefc4f08f39ea78480ffc Mon Sep 17 00:00:00 2001 From: ColinChen2 Date: Mon, 25 Sep 2023 15:56:41 +0800 Subject: [PATCH] fix: update clear order --- packages/g6/src/stdlib/plugin/edgeFilterLens/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/g6/src/stdlib/plugin/edgeFilterLens/index.ts b/packages/g6/src/stdlib/plugin/edgeFilterLens/index.ts index 94b2fc235a..398f3c9691 100644 --- a/packages/g6/src/stdlib/plugin/edgeFilterLens/index.ts +++ b/packages/g6/src/stdlib/plugin/edgeFilterLens/index.ts @@ -334,9 +334,7 @@ export class EdgeFilterLens extends Base { */ public clear() { const { graph, delegate: lensDelegate, cachedTransientNodes, cachedTransientEdges } = this; - cachedTransientNodes.clear(); - cachedTransientEdges.clear(); - + if (lensDelegate && !lensDelegate.destroyed) { graph.drawTransient('circle', 'lens-shape', { action: 'remove' }); } @@ -346,6 +344,9 @@ export class EdgeFilterLens extends Base { cachedTransientEdges.forEach((id) => { graph.drawTransient('edge', id, { action: 'remove' }); }); + + cachedTransientNodes.clear(); + cachedTransientEdges.clear(); } /**