Skip to content

Commit 7e95260

Browse files
committed
fix: don't create sources for BINDABLE_FALLBACK_SYMBOL
1 parent 4f7c3bd commit 7e95260

File tree

1 file changed

+13
-7
lines changed
  • packages/svelte/src/internal/client

1 file changed

+13
-7
lines changed

packages/svelte/src/internal/client/proxy.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,17 @@ export function proxy(value) {
6363

6464
return new Proxy(/** @type {any} */ (value), {
6565
defineProperty(_, prop, descriptor) {
66+
// we allow non enumerable/writable defines if the prop being set is our own symbol
67+
// this should be fine for the invariants since the user can't get a handle to the symbol
68+
if (DEV && prop === BINDABLE_FALLBACK_SYMBOL) {
69+
return Reflect.defineProperty(_, prop, descriptor);
70+
}
71+
6672
if (
67-
// we allow non enumerable/writable defines if the prop being set is our own symbol
68-
// this should be fine for the invariants since the user can't get a handle to the symbol
69-
(!DEV || prop !== BINDABLE_FALLBACK_SYMBOL) &&
70-
(!('value' in descriptor) ||
71-
descriptor.configurable === false ||
72-
descriptor.enumerable === false ||
73-
descriptor.writable === false)
73+
!('value' in descriptor) ||
74+
descriptor.configurable === false ||
75+
descriptor.enumerable === false ||
76+
descriptor.writable === false
7477
) {
7578
// we disallow non-basic descriptors, because unless they are applied to the
7679
// target object — which we avoid, so that state can be forked — we will run
@@ -126,6 +129,9 @@ export function proxy(value) {
126129
if (prop === STATE_SYMBOL) {
127130
return value;
128131
}
132+
if (DEV && prop === BINDABLE_FALLBACK_SYMBOL) {
133+
return Reflect.get(target, prop);
134+
}
129135

130136
var s = sources.get(prop);
131137
var exists = prop in target;

0 commit comments

Comments
 (0)