@@ -217,27 +217,22 @@ function getTagTrackedProps(tag, ownTag, level = 0) {
217
217
}
218
218
const subtags = tag . subtags || ( Array . isArray ( tag . subtag ) ? tag . subtag : [ ] ) ;
219
219
if ( tag . subtag && ! Array . isArray ( tag . subtag ) ) {
220
- if ( tag . subtag . _propertyKey )
221
- props . push (
222
- ( tag . subtag . _object ? getObjectName ( tag . subtag . _object ) + '.' : '' ) +
223
- tag . subtag . _propertyKey
224
- ) ;
220
+ if ( tag . subtag . _propertyKey ) props . push ( tag . subtag ) ;
221
+
225
222
props . push ( ...getTagTrackedProps ( tag . subtag , ownTag , level + 1 ) ) ;
226
223
}
227
224
if ( subtags ) {
228
225
subtags . forEach ( ( t ) => {
229
226
if ( t === ownTag ) return ;
230
- if ( t . _propertyKey )
231
- props . push (
232
- ( t . _object ? getObjectName ( t . _object ) + '.' : '' ) + t . _propertyKey
233
- ) ;
227
+ if ( t . _propertyKey ) props . push ( t ) ;
234
228
props . push ( ...getTagTrackedProps ( t , ownTag , level + 1 ) ) ;
235
229
} ) ;
236
230
}
237
231
return props ;
238
232
}
239
233
240
- function getTrackedDependencies ( object , property , tag ) {
234
+ function getTrackedDependencies ( object , property , tagInfo ) {
235
+ const tag = tagInfo . tag ;
241
236
const proto = Object . getPrototypeOf ( object ) ;
242
237
if ( ! proto ) return [ ] ;
243
238
const cpDesc = emberMeta ( object ) . peekDescriptors ( property ) ;
@@ -249,21 +244,32 @@ function getTrackedDependencies(object, property, tag) {
249
244
const ownTag = tagForProperty ( object , property ) ;
250
245
const props = getTagTrackedProps ( tag , ownTag ) ;
251
246
const mapping = { } ;
252
- props . forEach ( ( p ) => {
247
+ let maxRevision = tagInfo . revision ?? 0 ;
248
+ let minRevision = Infinity ;
249
+ props . forEach ( ( t ) => {
250
+ const p =
251
+ ( t . _object ? getObjectName ( t . _object ) + '.' : '' ) + t . _propertyKey ;
253
252
const [ objName , ...props ] = p . split ( '.' ) ;
254
253
mapping [ objName ] = mapping [ objName ] || new Set ( ) ;
255
- props . forEach ( ( p ) => mapping [ objName ] . add ( p ) ) ;
254
+ maxRevision = Math . max ( maxRevision , t . revision ) ;
255
+ minRevision = Math . min ( minRevision , t . revision ) ;
256
+ props . forEach ( ( p ) => mapping [ objName ] . add ( [ p , t . revision ] ) ) ;
256
257
} ) ;
257
258
259
+ const hasChange = maxRevision !== minRevision ;
260
+
258
261
Object . entries ( mapping ) . forEach ( ( [ objName , props ] ) => {
259
262
if ( props . size > 1 ) {
260
263
dependentKeys . push ( objName ) ;
261
264
props . forEach ( ( p ) => {
262
- dependentKeys . push ( ' • -- ' + p ) ;
265
+ const changed = hasChange && p [ 1 ] >= maxRevision ? ' 🔸' : '' ;
266
+ dependentKeys . push ( ' • -- ' + p [ 0 ] + changed ) ;
263
267
} ) ;
264
268
}
265
269
if ( props . size === 1 ) {
266
- dependentKeys . push ( objName + '.' + [ ...props ] [ 0 ] ) ;
270
+ const p = [ ...props ] [ 0 ] ;
271
+ const changed = hasChange && p [ 1 ] >= maxRevision ? ' 🔸' : '' ;
272
+ dependentKeys . push ( objName + '.' + p [ 0 ] + changed ) ;
267
273
}
268
274
if ( props . size === 0 ) {
269
275
dependentKeys . push ( objName ) ;
@@ -325,7 +331,6 @@ export default class extends DebugPort {
325
331
tagInfo . tag = track ( ( ) => {
326
332
value = object . get ?. ( item . name ) || object [ item . name ] ;
327
333
} ) ;
328
- tagInfo . revision = tagValue ( tagInfo . tag ) ;
329
334
}
330
335
tracked [ item . name ] = tagInfo ;
331
336
} else {
@@ -344,8 +349,9 @@ export default class extends DebugPort {
344
349
dependentKeys = getTrackedDependencies (
345
350
object ,
346
351
item . name ,
347
- tracked [ item . name ] . tag
352
+ tracked [ item . name ]
348
353
) ;
354
+ tracked [ item . name ] . revision = tagValue ( tracked [ item . name ] . tag ) ;
349
355
}
350
356
this . sendMessage ( 'updateProperty' , {
351
357
objectId,
@@ -1121,12 +1127,12 @@ function calculateCPs(
1121
1127
item . isTracked = true ;
1122
1128
}
1123
1129
}
1124
- tagInfo . revision = tagValue ( tagInfo . tag ) ;
1125
1130
item . dependentKeys = getTrackedDependencies (
1126
1131
object ,
1127
1132
item . name ,
1128
- tagInfo . tag
1133
+ tagInfo
1129
1134
) ;
1135
+ tagInfo . revision = tagValue ( tagInfo . tag ) ;
1130
1136
} else {
1131
1137
value = calculateCP ( object , item , errorsForObject ) ;
1132
1138
}
0 commit comments