From dcfae026da09fff4b85266777c6971fefa7cb8a9 Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Wed, 31 Jan 2024 11:42:53 +0000 Subject: [PATCH] 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> --- .changeset/wise-radios-exercise.md | 5 +++++ packages/svelte/src/internal/client/proxy.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/wise-radios-exercise.md diff --git a/.changeset/wise-radios-exercise.md b/.changeset/wise-radios-exercise.md new file mode 100644 index 0000000000..1d13af7758 --- /dev/null +++ b/.changeset/wise-radios-exercise.md @@ -0,0 +1,5 @@ +--- +"svelte": patch +--- + +fix: improve unstate handling of non enumerable properties diff --git a/packages/svelte/src/internal/client/proxy.js b/packages/svelte/src/internal/client/proxy.js index 23440a56e4..8add490a10 100644 --- a/packages/svelte/src/internal/client/proxy.js +++ b/packages/svelte/src/internal/client/proxy.js @@ -84,10 +84,11 @@ function unwrap(value, already_unwrapped = new Map()) { } else { /** @type {Record} */ const obj = {}; - const keys = object_keys(value); + const keys = Reflect.ownKeys(value); const descriptors = get_descriptors(value); already_unwrapped.set(value, obj); for (const key of keys) { + if (key === STATE_SYMBOL || (DEV && key === READONLY_SYMBOL)) continue; if (descriptors[key].get) { define_property(obj, key, descriptors[key]); } else {