fix: improve unstate handling of non enumerable properties (#10348)

* fix: improve unstate handling of non enumerable properties

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

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
pull/10327/head
Dominic Gannaway 12 months ago committed by GitHub
parent f9ed9cfc4b
commit dcfae026da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"svelte": patch
---
fix: improve unstate handling of non enumerable properties

@ -84,10 +84,11 @@ function unwrap(value, already_unwrapped = new Map()) {
} else { } else {
/** @type {Record<string | symbol, any>} */ /** @type {Record<string | symbol, any>} */
const obj = {}; const obj = {};
const keys = object_keys(value); const keys = Reflect.ownKeys(value);
const descriptors = get_descriptors(value); const descriptors = get_descriptors(value);
already_unwrapped.set(value, obj); already_unwrapped.set(value, obj);
for (const key of keys) { for (const key of keys) {
if (key === STATE_SYMBOL || (DEV && key === READONLY_SYMBOL)) continue;
if (descriptors[key].get) { if (descriptors[key].get) {
define_property(obj, key, descriptors[key]); define_property(obj, key, descriptors[key]);
} else { } else {

Loading…
Cancel
Save