From 2fd88bd8d06bab78e9b39f0dac724509fd392f0f Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sat, 31 Dec 2022 19:29:27 -0500 Subject: [PATCH] Update --- .../d3-state-visualizer/src/charts/tree/tree.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/d3-state-visualizer/src/charts/tree/tree.ts b/packages/d3-state-visualizer/src/charts/tree/tree.ts index 9b720d5b..e1b9066a 100644 --- a/packages/d3-state-visualizer/src/charts/tree/tree.ts +++ b/packages/d3-state-visualizer/src/charts/tree/tree.ts @@ -511,12 +511,17 @@ export default function ( // blink updated nodes node - .filter(function flick(this: any, d) { + .filter(function flick( + this: SVGGElement & { + __oldData__?: HierarchyPointNodeWithPrivateChildren; + }, + d + ) { // test whether the relevant properties of d match // the equivalent property of the oldData // also test whether the old data exists, // to catch the entering elements! - return this.__oldData__ && d.value !== this.__oldData__.value; + return !!this.__oldData__ && d.value !== this.__oldData__.value; }) .select('g') .style('opacity', '0.3') @@ -526,13 +531,13 @@ export default function ( // transition exiting nodes to the parent's new position const nodeExit = node - .exit() + .exit>() .transition() .duration(transitionDuration) .attr('transform', (d) => { const position = findParentNodePosition( previousNodePositionsById, - d.id, + d.data.id, (n) => !!nodePositionsById[n.id] ); const futurePosition =