From e1cfa14f938673635200289dd2832fed68b73a39 Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Tue, 28 Nov 2023 15:28:59 +0000 Subject: [PATCH] check visited for cyclical values --- packages/svelte/src/internal/client/runtime.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/svelte/src/internal/client/runtime.js b/packages/svelte/src/internal/client/runtime.js index ba47613426..ce2500b577 100644 --- a/packages/svelte/src/internal/client/runtime.js +++ b/packages/svelte/src/internal/client/runtime.js @@ -1800,12 +1800,14 @@ export function pop(accessors) { /** * @param {any} value + * @param {Set} visited * @returns {void} */ -function deep_read(value) { - if (typeof value === 'object' && value !== null) { +function deep_read(value, visited = new Set()) { + if (typeof value === 'object' && value !== null && !visited.has(value)) { + visited.add(value); for (let key in value) { - deep_read(value[key]); + deep_read(value[key], visited); } const proto = Object.getPrototypeOf(value); if (