@@ -23,6 +23,7 @@ import { safe_equals } from './equality.js';
2323import * as e from '../errors.js' ;
2424import { BRANCH_EFFECT , DESTROYED , LEGACY_DERIVED_PROP , ROOT_EFFECT } from '../constants.js' ;
2525import { proxy } from '../proxy.js' ;
26+ import { capture_marked_store_sub } from './store.js' ;
2627
2728/**
2829 * @param {((value?: number) => number) } fn
@@ -273,8 +274,14 @@ export function prop(props, key, flags, fallback) {
273274 var runes = ( flags & PROPS_IS_RUNES ) !== 0 ;
274275 var bindable = ( flags & PROPS_IS_BINDABLE ) !== 0 ;
275276 var lazy = ( flags & PROPS_IS_LAZY_INITIAL ) !== 0 ;
277+ var is_store_sub = false ;
278+ var prop_value ;
276279
277- var prop_value = /** @type {V } */ ( props [ key ] ) ;
280+ if ( bindable ) {
281+ [ prop_value , is_store_sub ] = capture_marked_store_sub ( ( ) => /** @type {V } */ ( props [ key ] ) ) ;
282+ } else {
283+ prop_value = /** @type {V } */ ( props [ key ] ) ;
284+ }
278285 var setter = get_descriptor ( props , key ) ?. set ;
279286
280287 var fallback_value = /** @type {V } */ ( fallback ) ;
@@ -343,7 +350,7 @@ export function prop(props, key, flags, fallback) {
343350 // In that case the state proxy (if it exists) should take care of the notification.
344351 // If the parent is not in runes mode, we need to notify on mutation, too, that the prop
345352 // has changed because the parent will not be able to detect the change otherwise.
346- if ( ! runes || ! mutation || legacy_parent ) {
353+ if ( ! runes || ! mutation || legacy_parent || is_store_sub ) {
347354 /** @type {Function } */ ( setter ) ( mutation ? getter ( ) : value ) ;
348355 }
349356 return value ;
0 commit comments