pull/16270/head
Rich Harris 3 months ago
parent 8a6d5ed34b
commit e0ebcc8b5d

@ -373,35 +373,25 @@ export function prop(props, key, flags, fallback) {
} }
return function (/** @type {any} */ value, /** @type {boolean} */ mutation) { return function (/** @type {any} */ value, /** @type {boolean} */ mutation) {
// legacy nonsense — need to ensure the source is invalidated when necessary
// also needed for when handling inspect logic so we can inspect the correct source signal
if (captured_signals !== null) {
// invoke getters so that signals are picked up by `invalidate_inner_signals`
getter();
get(current_value);
}
if (arguments.length > 0) { if (arguments.length > 0) {
const new_value = mutation ? get(current_value) : runes && bindable ? proxy(value) : value; const new_value = mutation ? get(current_value) : runes && bindable ? proxy(value) : value;
if (!current_value.equals(new_value)) { if (!current_value.equals(new_value)) {
set(current_value, new_value); set(current_value, new_value);
// To ensure the fallback value is consistent when used with proxies, we // To ensure the fallback value is consistent when used with proxies, we
// update the local fallback_value, but only if the fallback is actively used // update the local fallback_value, but only if the fallback is actively used
if (fallback_used && fallback_value !== undefined) { if (fallback_used && fallback_value !== undefined) {
fallback_value = new_value; fallback_value = new_value;
} }
if (has_destroyed_component_ctx(current_value)) {
return value;
}
untrack(() => get(current_value)); // force a synchronisation immediately untrack(() => get(current_value)); // force a synchronisation immediately
} }
return value; return value;
} }
// TODO is this still necessary post-#16263?
if (has_destroyed_component_ctx(current_value)) { if (has_destroyed_component_ctx(current_value)) {
return current_value.v; return current_value.v;
} }

Loading…
Cancel
Save