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(() => {