@@ -209,7 +209,7 @@ function isMandatorySetter(descriptor) {
209
209
return false ;
210
210
}
211
211
212
- function getTagTrackedProps ( tag , ownTag , level = 0 ) {
212
+ function getTagTrackedTags ( tag , ownTag , level = 0 ) {
213
213
const props = [ ] ;
214
214
// do not include tracked properties from dependencies
215
215
if ( ! tag || level > 1 ) {
@@ -219,13 +219,13 @@ function getTagTrackedProps(tag, ownTag, level = 0) {
219
219
if ( tag . subtag && ! Array . isArray ( tag . subtag ) ) {
220
220
if ( tag . subtag . _propertyKey ) props . push ( tag . subtag ) ;
221
221
222
- props . push ( ...getTagTrackedProps ( tag . subtag , ownTag , level + 1 ) ) ;
222
+ props . push ( ...getTagTrackedTags ( tag . subtag , ownTag , level + 1 ) ) ;
223
223
}
224
224
if ( subtags ) {
225
225
subtags . forEach ( ( t ) => {
226
226
if ( t === ownTag ) return ;
227
227
if ( t . _propertyKey ) props . push ( t ) ;
228
- props . push ( ...getTagTrackedProps ( t , ownTag , level + 1 ) ) ;
228
+ props . push ( ...getTagTrackedTags ( t , ownTag , level + 1 ) ) ;
229
229
} ) ;
230
230
}
231
231
return props ;
@@ -244,21 +244,22 @@ function getTrackedDependencies(object, property, tagInfo) {
244
244
}
245
245
if ( HAS_GLIMMER_TRACKING ) {
246
246
const ownTag = tagForProperty ( object , property ) ;
247
- const props = getTagTrackedProps ( tag , ownTag ) ;
247
+ const tags = getTagTrackedTags ( tag , ownTag ) ;
248
248
const mapping = { } ;
249
- let maxRevision = tagInfo . revision ?? 0 ;
250
- let minRevision = Infinity ;
251
- props . forEach ( ( t ) => {
249
+ let maxRevision = tagValue ( tag ) ;
250
+ tags . forEach ( ( t ) => {
252
251
const p =
253
252
( t . _object ? getObjectName ( t . _object ) + '.' : '' ) + t . _propertyKey ;
254
- const [ objName , ... props ] = p . split ( '.' ) ;
253
+ const [ objName , prop ] = p . split ( '.' ) ;
255
254
mapping [ objName ] = mapping [ objName ] || new Set ( ) ;
256
- maxRevision = Math . max ( maxRevision , t . revision ) ;
257
- minRevision = Math . min ( minRevision , t . revision ) ;
258
- props . forEach ( ( p ) => mapping [ objName ] . add ( [ p , t . revision ] ) ) ;
255
+ const value = tagValue ( t ) ;
256
+ if ( prop ) {
257
+ mapping [ objName ] . add ( [ prop , value ] ) ;
258
+ }
259
259
} ) ;
260
260
261
- const hasChange = maxRevision !== minRevision ;
261
+ const hasChange =
262
+ ( tagInfo . revision && maxRevision !== tagInfo . revision ) || false ;
262
263
263
264
const names = new Set ( ) ;
264
265
@@ -270,7 +271,7 @@ function getTrackedDependencies(object, property, tagInfo) {
270
271
if ( props . size > 1 ) {
271
272
dependentKeys . push ( { name : objName } ) ;
272
273
props . forEach ( ( p ) => {
273
- const changed = hasChange && p [ 1 ] >= maxRevision ;
274
+ const changed = hasChange && p [ 1 ] > tagInfo . revision ;
274
275
const obj = {
275
276
child : p [ 0 ] ,
276
277
} ;
@@ -282,7 +283,7 @@ function getTrackedDependencies(object, property, tagInfo) {
282
283
}
283
284
if ( props . size === 1 ) {
284
285
const p = [ ...props ] [ 0 ] ;
285
- const changed = hasChange && p [ 1 ] >= maxRevision ;
286
+ const changed = hasChange && p [ 1 ] > tagInfo . revision ;
286
287
const obj = {
287
288
name : objName + '.' + p [ 0 ] ,
288
289
} ;
@@ -1137,7 +1138,8 @@ function calculateCPs(
1137
1138
if ( cache !== undefined || ! item . isExpensive ) {
1138
1139
let value ;
1139
1140
if ( item . canTrack && HAS_GLIMMER_TRACKING ) {
1140
- const tagInfo = ( tracked [ item . name ] = { } ) ;
1141
+ tracked [ item . name ] = tracked [ item . name ] || { } ;
1142
+ const tagInfo = tracked [ item . name ] ;
1141
1143
tagInfo . tag = track ( ( ) => {
1142
1144
value = calculateCP ( object , item , errorsForObject ) ;
1143
1145
} ) ;
0 commit comments