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

testing: fix performance when unloading a bunch of tests #197294

Merged
merged 1 commit into from
Nov 3, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,9 @@ export class TreeProjection extends Disposable implements ITestTreeProjection {
}

// The first element will cause the root to be hidden
const affectsRootElement = toRemove.depth === 1 && toRemove.parent?.children.size === 1;
this.changedParents.add(affectsRootElement ? null : toRemove.parent);
const parent = toRemove.parent;
const affectsRootElement = toRemove.depth === 1 && parent?.children.size === 1;
this.changedParents.add(affectsRootElement ? null : parent);

const queue: Iterable<TestExplorerTreeElement>[] = [[toRemove]];
while (queue.length) {
Expand All @@ -235,6 +236,10 @@ export class TreeProjection extends Disposable implements ITestTreeProjection {
}
}
}

if (parent instanceof TreeTestItemElement) {
refreshComputedState(computedStateAccessor, parent, undefined, !!parent.duration).forEach(i => i.fireChange());
}
}
}
}
Expand Down Expand Up @@ -290,10 +295,6 @@ export class TreeProjection extends Disposable implements ITestTreeProjection {
const parent = treeElement.parent;
parent?.children.delete(treeElement);
this.items.delete(treeElement.test.item.extId);
if (parent instanceof TreeTestItemElement) {
refreshComputedState(computedStateAccessor, parent, undefined, !!treeElement.duration).forEach(i => i.fireChange());
}

return treeElement.children;
}

Expand Down