From e57e90c90004db1c401651f6d8023b7b13a57fe7 Mon Sep 17 00:00:00 2001 From: patrick Date: Fri, 10 Nov 2023 10:28:19 +0100 Subject: [PATCH] improve tracked detection --- ember_debug/object-inspector.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ember_debug/object-inspector.js b/ember_debug/object-inspector.js index e50f0faaaf..1f06617af4 100644 --- a/ember_debug/object-inspector.js +++ b/ember_debug/object-inspector.js @@ -76,8 +76,10 @@ try { } } +let TrackedDescriptor; try { let metal = EmberLoader.require('@ember/-internals/metal'); + TrackedDescriptor = metal.TrackedDescriptor; tagForProperty = metal.tagForProperty; // If track was not already loaded, use metal's version (the previous version) @@ -968,6 +970,12 @@ function addProperties(properties, hash) { if (desc.get) { options.isGetter = true; options.canTrack = true; + options.isTracked = + desc.isTracked || + (TrackedDescriptor && desc instanceof TrackedDescriptor); + if (options.isTracked) { + options.code = ''; + } if (!desc.set) { options.readOnly = true; } @@ -1115,12 +1123,6 @@ function calculateCPs( tagInfo.tag = track(() => { value = calculateCP(object, item, errorsForObject); }); - if (tagInfo.tag === tagForProperty(object, item.name)) { - if (!item.isComputed && !item.isService) { - item.code = ''; - item.isTracked = true; - } - } tagInfo.revision = tagValue(tagInfo.tag); item.dependentKeys = getTrackedDependencies( object,