From bf5b7216c9d22757fde1abb56f78be3cacfad23c Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 12 Jun 2025 09:01:40 -0400 Subject: [PATCH] WIP --- .../phases/3-transform/client/visitors/shared/utils.js | 6 +++++- .../samples/purity/_expected/client/index.svelte.js | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/utils.js b/packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/utils.js index 68299668d4..f69e1db2d4 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/utils.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/utils.js @@ -387,7 +387,11 @@ export function build_expression(context, expression, metadata, state = context. var getter = build_getter({ ...binding.node }, state); - if (binding.kind === 'bindable_prop') { + if ( + binding.kind === 'bindable_prop' || + binding.node.name === '$$props' || + binding.node.name === '$$restProps' + ) { getter = b.call('$.deep_read_state', getter); } diff --git a/packages/svelte/tests/snapshot/samples/purity/_expected/client/index.svelte.js b/packages/svelte/tests/snapshot/samples/purity/_expected/client/index.svelte.js index a351851875..da6fdf44d8 100644 --- a/packages/svelte/tests/snapshot/samples/purity/_expected/client/index.svelte.js +++ b/packages/svelte/tests/snapshot/samples/purity/_expected/client/index.svelte.js @@ -8,11 +8,13 @@ export default function Purity($$anchor) { var fragment = root(); var p = $.first_child(fragment); - p.textContent = '0'; + p.textContent = ( + $.untrack(() => Math.max(0, Math.min(0, 100))) + ); var p_1 = $.sibling(p, 2); - p_1.textContent = location.href; + p_1.textContent = ($.untrack(() => location.href)); var node = $.sibling(p_1, 2);