fix: prevent proxy validation error (#12442)

Fixes a test running in HMR mode that revealed this bug
pull/12443/head
Simon H 4 months ago committed by GitHub
parent 73d97f7af9
commit e74341a227
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -165,7 +165,16 @@ const spread_props_handler = {
while (i--) {
let p = target.props[i];
if (is_function(p)) p = p();
if (typeof p === 'object' && p !== null && key in p) return get_descriptor(p, key);
if (typeof p === 'object' && p !== null && key in p) {
const descriptor = get_descriptor(p, key);
if (descriptor && !descriptor.configurable) {
// Prevent a "Non-configurability Report Error": The target is an array, it does
// not actually contain this property. If it is now described as non-configurable,
// the proxy throws a validation error. Setting it to true avoids that.
descriptor.configurable = true;
}
return descriptor;
}
}
},
has(target, key) {

Loading…
Cancel
Save