From 1b56a3219c12d1fc15a6bbb74746f6ee9727057f Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Tue, 13 Feb 2024 11:24:36 +0000 Subject: [PATCH] fix: ensure inspect fires on prop changes (#10468) * fix: ensure inspect fires on prop changes * fix: ensure inspect fires on prop changes * fix: ensure inspect fires on prop changes --- .changeset/spicy-jeans-deliver.md | 5 +++++ packages/svelte/src/internal/client/runtime.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/spicy-jeans-deliver.md diff --git a/.changeset/spicy-jeans-deliver.md b/.changeset/spicy-jeans-deliver.md new file mode 100644 index 0000000000..80c343eca8 --- /dev/null +++ b/.changeset/spicy-jeans-deliver.md @@ -0,0 +1,5 @@ +--- +"svelte": patch +--- + +fix: ensure inspect fires on prop changes diff --git a/packages/svelte/src/internal/client/runtime.js b/packages/svelte/src/internal/client/runtime.js index 1fe72efa41..cf55be1f5e 100644 --- a/packages/svelte/src/internal/client/runtime.js +++ b/packages/svelte/src/internal/client/runtime.js @@ -1646,7 +1646,8 @@ export function prop(props, key, flags, initial) { var current = get(current_value); // legacy nonsense — need to ensure the source is invalidated when necessary - if (is_signals_recorded) { + // also needed for when handling inspect logic so we can inspect the correct source signal + if (is_signals_recorded || (DEV && inspect_fn)) { // set this so that we don't reset to the parent value if `d` // is invalidated because of `invalidate_inner_signals` (rather // than because the parent or child value changed)