1- /** @import { Source } from './types.js' */
1+ /** @import { Derived, Source } from './types.js' */
22import { DEV } from 'esm-env' ;
33import {
44 PROPS_IS_BINDABLE ,
@@ -20,7 +20,7 @@ import {
2020} from '../runtime.js' ;
2121import { safe_equals } from './equality.js' ;
2222import * as e from '../errors.js' ;
23- import { BRANCH_EFFECT , LEGACY_DERIVED_PROP , ROOT_EFFECT } from '../constants.js' ;
23+ import { BRANCH_EFFECT , DESTROYED , LEGACY_DERIVED_PROP , ROOT_EFFECT } from '../constants.js' ;
2424import { proxy } from '../proxy.js' ;
2525
2626/**
@@ -292,6 +292,8 @@ export function prop(props, key, flags, fallback) {
292292
293293 /** @type {() => V } */
294294 var getter ;
295+ /** @type {Derived } */
296+ var derived_getter ;
295297 if ( runes ) {
296298 getter = ( ) => {
297299 var value = /** @type {V } */ ( props [ key ] ) ;
@@ -303,7 +305,7 @@ export function prop(props, key, flags, fallback) {
303305 } else {
304306 // Svelte 4 did not trigger updates when a primitive value was updated to the same value.
305307 // Replicate that behavior through using a derived
306- var derived_getter = with_parent_branch ( ( ) =>
308+ derived_getter = with_parent_branch ( ( ) =>
307309 ( immutable ? derived : derived_safe_equal ) ( ( ) => /** @type {V } */ ( props [ key ] ) )
308310 ) ;
309311 derived_getter . f |= LEGACY_DERIVED_PROP ;
@@ -353,12 +355,11 @@ export function prop(props, key, flags, fallback) {
353355 var parent_value = getter ( ) ;
354356 var child_value = get ( inner_current_value ) ;
355357
356- if ( from_child ) {
358+ if ( from_child || ( derived_getter !== undefined && ( derived_getter . f & DESTROYED ) !== 0 ) ) {
357359 from_child = false ;
358360 was_from_child = true ;
359361 return child_value ;
360362 }
361-
362363 was_from_child = false ;
363364 return ( inner_current_value . v = parent_value ) ;
364365 } )
0 commit comments