Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/svelte/src/internal/client/reactivity/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,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;
}

Expand All @@ -362,8 +362,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 d = ((flags & PROPS_IS_IMMUTABLE) !== 0 ? derived : derived_safe_equal)(getter);

// Capture the initial value if it's bindable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down