Skip to content

Commit e5c9502

Browse files
authored
Lazily resolved checkbox tree items inconsistently receive parent checked state (microsoft#186738)
Fixes microsoft#186663
1 parent 14f3179 commit e5c9502

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/vs/workbench/browser/parts/views/treeView.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,20 @@ abstract class AbstractTreeView extends Disposable implements ITreeView {
344344

345345
async getChildren(node?: ITreeItem): Promise<ITreeItem[]> {
346346
let children: ITreeItem[];
347+
const checkboxesUpdated: ITreeItem[] = [];
347348
if (node && node.children) {
348349
children = node.children;
349350
} else {
350351
node = node ?? self.root;
351352
node.children = await (node instanceof Root ? dataProvider.getChildren() : dataProvider.getChildren(node));
352353
children = node.children ?? [];
353-
children.forEach(child => child.parent = node);
354+
children.forEach(child => {
355+
child.parent = node;
356+
if (!self.manuallyManageCheckboxes && (node?.checkbox?.isChecked === true) && (child.checkbox?.isChecked === false)) {
357+
child.checkbox.isChecked = true;
358+
checkboxesUpdated.push(child);
359+
}
360+
});
354361
}
355362
if (node instanceof Root) {
356363
const oldEmpty = this._isEmpty;
@@ -359,6 +366,9 @@ abstract class AbstractTreeView extends Disposable implements ITreeView {
359366
this._onDidChangeEmpty.fire();
360367
}
361368
}
369+
if (checkboxesUpdated.length > 0) {
370+
self._onDidChangeCheckboxState.fire(checkboxesUpdated);
371+
}
362372
return children;
363373
}
364374
};

0 commit comments

Comments
 (0)