Skip to content

Commit 07952e1

Browse files
committed
"unown" proxy when in another source declaration
1 parent 61116b4 commit 07952e1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { get_rune } from '../../../scope.js';
99
import { get_prop_source, is_prop_source, is_state_source, should_proxy } from '../utils.js';
1010
import { is_hoisted_function } from '../../utils.js';
1111
import { get_value } from './shared/declarations.js';
12+
import { PROXY_REMOVE_PATH } from '#client/constants';
1213

1314
/**
1415
* @param {VariableDeclaration} node
@@ -131,7 +132,12 @@ export function VariableDeclaration(node, context) {
131132
const is_state = is_state_source(binding, context.state.analysis);
132133
const is_proxy = should_proxy(value, context.state.scope);
133134
if (rune === '$state' && is_proxy) {
134-
value = b.call('$.proxy', value, dev ? b.literal(id.name) : undefined);
135+
value = b.call(
136+
'$.proxy',
137+
value,
138+
dev ? b.literal(id.name) : undefined,
139+
dev ? b.literal(PROXY_REMOVE_PATH) : undefined
140+
);
135141
}
136142
if (is_state) {
137143
value = b.call('$.state', value);

0 commit comments

Comments
 (0)