Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve tracked detection #2504

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 8 additions & 6 deletions ember_debug/object-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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,
Expand Down