From 5415cc5315614cea52b253a14f234a63040542c6 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 21 Jun 2024 15:33:32 -0400 Subject: [PATCH] rename --- .../src/internal/client/reactivity/props.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/svelte/src/internal/client/reactivity/props.js b/packages/svelte/src/internal/client/reactivity/props.js index e84f8bb9b9..3232239a75 100644 --- a/packages/svelte/src/internal/client/reactivity/props.js +++ b/packages/svelte/src/internal/client/reactivity/props.js @@ -268,16 +268,16 @@ export function prop(props, key, flags, fallback) { // `bind:foo` which means we can just call `$$props.foo = value` directly if (setter) { var legacy_parent = props.$$legacy; - return function (/** @type {any} */ assigned_value, /** @type {boolean} */ mutation) { + return function (/** @type {any} */ value, /** @type {boolean} */ mutation) { if (arguments.length > 0) { // We don't want to notify if the value was mutated and the parent is in runes mode. // In that case the state proxy (if it exists) should take care of the notification. // If the parent is not in runes mode, we need to notify on mutation, too, that the prop // has changed because the parent will not be able to detect the change otherwise. if (!runes || !mutation || legacy_parent) { - /** @type {Function} */ (setter)(mutation ? getter() : assigned_value); + /** @type {Function} */ (setter)(mutation ? getter() : value); } - return assigned_value; + return value; } else { return getter(); } @@ -309,7 +309,7 @@ export function prop(props, key, flags, fallback) { if (!immutable) current_value.equals = safe_equals; - return function (/** @type {any} */ reassigned_value, /** @type {boolean} */ mutation) { + return function (/** @type {any} */ value, /** @type {boolean} */ mutation) { var current = get(current_value); // legacy nonsense — need to ensure the source is invalidated when necessary @@ -325,14 +325,15 @@ export function prop(props, key, flags, fallback) { } if (arguments.length > 0) { - const value = mutation ? get(current_value) : reassigned_value; - if (!current_value.equals(value)) { + const new_value = mutation ? get(current_value) : value; + + if (!current_value.equals(new_value)) { from_child = true; - set(inner_current_value, value); + set(inner_current_value, new_value); get(current_value); // force a synchronisation immediately } - return reassigned_value; + return value; } return current;