diff --git a/.changeset/twelve-worms-jog.md b/.changeset/twelve-worms-jog.md new file mode 100644 index 0000000000..6eae9ea60e --- /dev/null +++ b/.changeset/twelve-worms-jog.md @@ -0,0 +1,5 @@ +--- +"svelte": patch +--- + +fix: correct context applied to batch_inspect diff --git a/packages/svelte/src/internal/client/runtime.js b/packages/svelte/src/internal/client/runtime.js index 49dfe69448..7f8a7cdf05 100644 --- a/packages/svelte/src/internal/client/runtime.js +++ b/packages/svelte/src/internal/client/runtime.js @@ -126,11 +126,14 @@ function is_runes(context) { */ export function batch_inspect(target, prop, receiver) { const value = Reflect.get(target, prop, receiver); + /** + * @this {any} + */ return function () { const previously_batching_effect = is_batching_effect; is_batching_effect = true; try { - return Reflect.apply(value, receiver, arguments); + return Reflect.apply(value, this, arguments); } finally { is_batching_effect = previously_batching_effect; if (last_inspected_signal !== null) {