From 15ebfdf0e93b228613557ebf95a027c563d58b03 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 30 Oct 2024 14:56:11 +0000 Subject: [PATCH] Fix settings added and removed by conditions not triggering component refresh --- packages/client/src/components/Component.svelte | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte index 9c8aada1bc..7a1341c67c 100644 --- a/packages/client/src/components/Component.svelte +++ b/packages/client/src/components/Component.svelte @@ -554,7 +554,12 @@ cachedSettings = { ...allSettings } initialSettings = cachedSettings } else { - Object.keys(allSettings).forEach(key => { + // We need to compare all keys from both the current and previous settings, as + // keys may have disappeared in the current set which would otherwise be ignored + // if we only checked the current set keys + const keys = new Set(Object.keys(allSettings)) + Object.keys(cachedSettings).forEach(key => keys.add(key)) + keys.forEach(key => { const same = propsAreSame(allSettings[key], cachedSettings[key]) if (!same) { // Updated cachedSettings (which is assigned by reference to