Skip to content

Commit

Permalink
Lazily resolved checkbox tree items inconsistently receive parent che…
Browse files Browse the repository at this point in the history
…cked state (#186739)

Fixes #186663
  • Loading branch information
alexr00 authored Jun 30, 2023
1 parent 8ddc0b4 commit 39efe30
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/vs/workbench/browser/parts/views/treeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,20 @@ abstract class AbstractTreeView extends Disposable implements ITreeView {

async getChildren(node?: ITreeItem): Promise<ITreeItem[]> {
let children: ITreeItem[];
const checkboxesUpdated: ITreeItem[] = [];
if (node && node.children) {
children = node.children;
} else {
node = node ?? self.root;
node.children = await (node instanceof Root ? dataProvider.getChildren() : dataProvider.getChildren(node));
children = node.children ?? [];
children.forEach(child => child.parent = node);
children.forEach(child => {
child.parent = node;
if (!self.manuallyManageCheckboxes && (node?.checkbox?.isChecked === true) && (child.checkbox?.isChecked === false)) {
child.checkbox.isChecked = true;
checkboxesUpdated.push(child);
}
});
}
if (node instanceof Root) {
const oldEmpty = this._isEmpty;
Expand All @@ -359,6 +366,9 @@ abstract class AbstractTreeView extends Disposable implements ITreeView {
this._onDidChangeEmpty.fire();
}
}
if (checkboxesUpdated.length > 0) {
self._onDidChangeCheckboxState.fire(checkboxesUpdated);
}
return children;
}
};
Expand Down

0 comments on commit 39efe30

Please sign in to comment.