@@ -1449,16 +1449,19 @@ export function prop(props, key, flags, initial) {
1449
1449
}
1450
1450
1451
1451
var setting_from_child = false ;
1452
+ var last_set_from_child = false ;
1452
1453
var s = mutable_source ( value ) ;
1453
1454
var d = derived ( ( ) => {
1454
1455
const from_parent = getter ( ) ;
1455
1456
const from_child = get ( s ) ;
1456
1457
1457
1458
if ( setting_from_child ) {
1458
1459
setting_from_child = false ;
1460
+ last_set_from_child = true ;
1459
1461
return from_child ;
1460
1462
}
1461
1463
1464
+ last_set_from_child = false ;
1462
1465
return ( s . v = from_parent ) ;
1463
1466
} ) ;
1464
1467
@@ -1468,13 +1471,17 @@ export function prop(props, key, flags, initial) {
1468
1471
const current = get ( d ) ;
1469
1472
1470
1473
// 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
+ }
1472
1479
1473
1480
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 ) ) ) {
1475
1482
setting_from_child = true ;
1476
1483
set ( s , mutation ? current : value ) ;
1477
- get ( d ) ;
1484
+ get ( d ) ; // force a synchronisation immediately
1478
1485
}
1479
1486
return value ;
1480
1487
}
0 commit comments