pull/16278/head
Rich Harris 3 months ago
commit 99f0464d4c

@ -364,7 +364,7 @@ export function prop(props, key, flags, fallback) {
}
// prop is never written to — we only need a getter
if ((flags & PROPS_IS_UPDATED) === 0) {
if (runes && (flags & PROPS_IS_UPDATED) === 0) {
return getter;
}
@ -390,8 +390,10 @@ export function prop(props, key, flags, fallback) {
};
}
// prop is written to, but there's no binding, which means we
// create a derived that we can write to locally
// Either prop is written to, but there's no binding, which means we
// create a derived that we can write to locally.
// Or we are in legacy mode where we always create a derived to replicate that
// Svelte 4 did not trigger updates when a primitive value was updated to the same value.
var overridden = false;
var d = ((flags & PROPS_IS_IMMUTABLE) !== 0 ? derived : derived_safe_equal)(() => {
@ -404,10 +406,6 @@ export function prop(props, key, flags, fallback) {
var parent_effect = /** @type {Effect} */ (active_effect);
if (!parent_effect) {
console.trace();
}
return function (/** @type {any} */ value, /** @type {boolean} */ mutation) {
if (arguments.length > 0) {
const new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;

@ -2,6 +2,7 @@ import { flushSync } from 'svelte';
import { test } from '../../test';
export default test({
accessors: false,
test({ assert, logs, target }) {
assert.deepEqual(logs, ['primitive', 'object']);
target.querySelector('button')?.click();

Loading…
Cancel
Save