From f06e2c55787f49e869ba0d931f095a5271a0c7a9 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 30 Apr 2024 18:16:25 -0400 Subject: [PATCH] chore: tidy up --- packages/svelte/src/internal/client/runtime.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/svelte/src/internal/client/runtime.js b/packages/svelte/src/internal/client/runtime.js index 4364a52199..ac07ec1922 100644 --- a/packages/svelte/src/internal/client/runtime.js +++ b/packages/svelte/src/internal/client/runtime.js @@ -184,17 +184,19 @@ export function check_dirtiness(reaction) { } } - // If we're working with an unowned derived signal, then we need to check - // if our dependency write version is higher. If it is then we can assume - // that state has changed to a newer version and thus this unowned signal - // is also dirty. - var version = dependency.version; - if (is_unowned) { + // If we're working with an unowned derived signal, then we need to check + // if our dependency write version is higher. If it is then we can assume + // that state has changed to a newer version and thus this unowned signal + // is also dirty. + var version = dependency.version; + if (version > /** @type {import('#client').Derived} */ (reaction).version) { /** @type {import('#client').Derived} */ (reaction).version = version; return true; - } else if (!current_skip_reaction && !dependency?.reactions?.includes(reaction)) { + } + + if (!current_skip_reaction && !dependency?.reactions?.includes(reaction)) { // If we are working with an unowned signal as part of an effect (due to !current_skip_reaction) // and the version hasn't changed, we still need to check that this reaction // if linked to the dependency source – otherwise future updates will not be caught.