From 88a84fff816a1dbed385a2683a91709395228586 Mon Sep 17 00:00:00 2001 From: paoloricciuti Date: Sat, 26 Oct 2024 19:11:59 +0200 Subject: [PATCH] chore: use set for version reactions --- packages/svelte/src/reactivity/map.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/svelte/src/reactivity/map.js b/packages/svelte/src/reactivity/map.js index c581a2791406..5572a76d4277 100644 --- a/packages/svelte/src/reactivity/map.js +++ b/packages/svelte/src/reactivity/map.js @@ -105,7 +105,12 @@ export class SvelteMap extends Map { increment(s); // if not every reaction of s is a reaction of version we need to also include version - const needs_version_increase = !s.reactions?.every((r) => version.reactions?.includes(r)); + var v_reactions = version.reactions === null ? null : new Set(version.reactions); + var needs_version_increase = + v_reactions === null || + !s.reactions?.every((r) => + /** @type {NonNullable} */ (v_reactions).has(r) + ); if (needs_version_increase) { increment(version); }