From 07952e14acd581e06204bb0e4695e86564428e45 Mon Sep 17 00:00:00 2001 From: ComputerGuy <63362464+Ocean-OS@users.noreply.github.com> Date: Sun, 1 Jun 2025 14:06:33 -0700 Subject: [PATCH] "unown" proxy when in another source declaration --- .../3-transform/client/visitors/VariableDeclaration.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js b/packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js index 9e2fbd7db8..1e29cb2d06 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js @@ -9,6 +9,7 @@ import { get_rune } from '../../../scope.js'; import { get_prop_source, is_prop_source, is_state_source, should_proxy } from '../utils.js'; import { is_hoisted_function } from '../../utils.js'; import { get_value } from './shared/declarations.js'; +import { PROXY_REMOVE_PATH } from '#client/constants'; /** * @param {VariableDeclaration} node @@ -131,7 +132,12 @@ export function VariableDeclaration(node, context) { const is_state = is_state_source(binding, context.state.analysis); const is_proxy = should_proxy(value, context.state.scope); if (rune === '$state' && is_proxy) { - value = b.call('$.proxy', value, dev ? b.literal(id.name) : undefined); + value = b.call( + '$.proxy', + value, + dev ? b.literal(id.name) : undefined, + dev ? b.literal(PROXY_REMOVE_PATH) : undefined + ); } if (is_state) { value = b.call('$.state', value);