Skip to content

Commit e74341a

Browse files
authored
fix: prevent proxy validation error (#12442)
Fixes a test running in HMR mode that revealed this bug
1 parent 73d97f7 commit e74341a

File tree

1 file changed

+10
-1
lines changed
  • packages/svelte/src/internal/client/reactivity

1 file changed

+10
-1
lines changed

packages/svelte/src/internal/client/reactivity/props.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,16 @@ const spread_props_handler = {
165165
while (i--) {
166166
let p = target.props[i];
167167
if (is_function(p)) p = p();
168-
if (typeof p === 'object' && p !== null && key in p) return get_descriptor(p, key);
168+
if (typeof p === 'object' && p !== null && key in p) {
169+
const descriptor = get_descriptor(p, key);
170+
if (descriptor && !descriptor.configurable) {
171+
// Prevent a "Non-configurability Report Error": The target is an array, it does
172+
// not actually contain this property. If it is now described as non-configurable,
173+
// the proxy throws a validation error. Setting it to true avoids that.
174+
descriptor.configurable = true;
175+
}
176+
return descriptor;
177+
}
169178
}
170179
},
171180
has(target, key) {

0 commit comments

Comments
 (0)