Skip to content

Commit 96bb197

Browse files
committed
yowzer
1 parent 1d95481 commit 96bb197

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/svelte/src/internal/client/runtime.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,16 +1449,19 @@ export function prop(props, key, flags, initial) {
14491449
}
14501450

14511451
var setting_from_child = false;
1452+
var last_set_from_child = false;
14521453
var s = mutable_source(value);
14531454
var d = derived(() => {
14541455
const from_parent = getter();
14551456
const from_child = get(s);
14561457

14571458
if (setting_from_child) {
14581459
setting_from_child = false;
1460+
last_set_from_child = true;
14591461
return from_child;
14601462
}
14611463

1464+
last_set_from_child = false;
14621465
return (s.v = from_parent);
14631466
});
14641467

@@ -1468,13 +1471,17 @@ export function prop(props, key, flags, initial) {
14681471
const current = get(d);
14691472

14701473
// legacy nonsense — need to ensure the source is invalidated when necessary
1471-
if (is_signals_recorded) get(s);
1474+
if (is_signals_recorded) {
1475+
setting_from_child = last_set_from_child;
1476+
getter();
1477+
get(s);
1478+
}
14721479

14731480
if (arguments.length > 0) {
1474-
if (mutation || (immutable ? value !== current : !safe_equal(value, current))) {
1481+
if (mutation || (immutable ? value !== current : safe_not_equal(value, current))) {
14751482
setting_from_child = true;
14761483
set(s, mutation ? current : value);
1477-
get(d);
1484+
get(d); // force a synchronisation immediately
14781485
}
14791486
return value;
14801487
}

0 commit comments

Comments
 (0)