Skip to content

Commit f1d6bf5

Browse files
committed
use last value
this is the correct thing
1 parent de96fb2 commit f1d6bf5

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

ember_debug/object-inspector.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function isMandatorySetter(descriptor) {
209209
return false;
210210
}
211211

212-
function getTagTrackedProps(tag, ownTag, level = 0) {
212+
function getTagTrackedTags(tag, ownTag, level = 0) {
213213
const props = [];
214214
// do not include tracked properties from dependencies
215215
if (!tag || level > 1) {
@@ -219,13 +219,13 @@ function getTagTrackedProps(tag, ownTag, level = 0) {
219219
if (tag.subtag && !Array.isArray(tag.subtag)) {
220220
if (tag.subtag._propertyKey) props.push(tag.subtag);
221221

222-
props.push(...getTagTrackedProps(tag.subtag, ownTag, level + 1));
222+
props.push(...getTagTrackedTags(tag.subtag, ownTag, level + 1));
223223
}
224224
if (subtags) {
225225
subtags.forEach((t) => {
226226
if (t === ownTag) return;
227227
if (t._propertyKey) props.push(t);
228-
props.push(...getTagTrackedProps(t, ownTag, level + 1));
228+
props.push(...getTagTrackedTags(t, ownTag, level + 1));
229229
});
230230
}
231231
return props;
@@ -244,21 +244,20 @@ function getTrackedDependencies(object, property, tagInfo) {
244244
}
245245
if (HAS_GLIMMER_TRACKING) {
246246
const ownTag = tagForProperty(object, property);
247-
const props = getTagTrackedProps(tag, ownTag);
247+
const tags = getTagTrackedTags(tag, ownTag);
248248
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) => {
252251
const p =
253252
(t._object ? getObjectName(t._object) + '.' : '') + t._propertyKey;
254-
const [objName, ...props] = p.split('.');
253+
const [objName, prop] = p.split('.');
255254
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+
mapping[objName].add([prop, value]);
259257
});
260258

261-
const hasChange = maxRevision !== minRevision;
259+
const hasChange =
260+
(tagInfo.revision && maxRevision !== tagInfo.revision) || false;
262261

263262
const names = new Set();
264263

@@ -270,7 +269,7 @@ function getTrackedDependencies(object, property, tagInfo) {
270269
if (props.size > 1) {
271270
dependentKeys.push({ name: objName });
272271
props.forEach((p) => {
273-
const changed = hasChange && p[1] >= maxRevision;
272+
const changed = hasChange && p[1] > tagInfo.revision;
274273
const obj = {
275274
child: p[0],
276275
};
@@ -282,7 +281,7 @@ function getTrackedDependencies(object, property, tagInfo) {
282281
}
283282
if (props.size === 1) {
284283
const p = [...props][0];
285-
const changed = hasChange && p[1] >= maxRevision;
284+
const changed = hasChange && p[1] > tagInfo.revision;
286285
const obj = {
287286
name: objName + '.' + p[0],
288287
};
@@ -1137,7 +1136,8 @@ function calculateCPs(
11371136
if (cache !== undefined || !item.isExpensive) {
11381137
let value;
11391138
if (item.canTrack && HAS_GLIMMER_TRACKING) {
1140-
const tagInfo = (tracked[item.name] = {});
1139+
tracked[item.name] = tracked[item.name] || {};
1140+
const tagInfo = tracked[item.name];
11411141
tagInfo.tag = track(() => {
11421142
value = calculateCP(object, item, errorsForObject);
11431143
});

0 commit comments

Comments
 (0)