From f0851086c0f602ccaf18a3a4b166658dbd8a5abc Mon Sep 17 00:00:00 2001 From: vcoppe Date: Thu, 8 Oct 2026 08:47:14 +0200 Subject: [PATCH] fix reactivity --- .../lib/components/toolbar/tools/reduce/Reduce.svelte | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/website/src/lib/components/toolbar/tools/reduce/Reduce.svelte b/website/src/lib/components/toolbar/tools/reduce/Reduce.svelte index f6b5144d3..ce7026491 100644 --- a/website/src/lib/components/toolbar/tools/reduce/Reduce.svelte +++ b/website/src/lib/components/toolbar/tools/reduce/Reduce.svelte @@ -29,11 +29,14 @@ let reducedLayer = new ReducedLayer(); + // read again only when the selection or the files change, not with the tolerance + let distances = $derived.by(() => { + void $statistics; + return engine.reductionDistances(); + }); + $effect(() => { - // recomputed when the selection or the files change - const stats = $statistics; - const distances = engine.reductionDistances(); - reducedLayer.update(stats, distances, $tolerance); + reducedLayer.update($statistics, distances, $tolerance); }); $effect(() => {