Skip to content

Commit 2660f43

Browse files
committed
Fix: Re-parent pulled-up directory children to ensure proper checkbox refresh
When the tree has multiple top-level directories, a temporary DirectoryTreeNode is created to build the tree, then its children are pulled up to the parent. However, the children's parent pointers still referenced the phantom root, causing processCheckboxUpdates to refresh an invisible node, so checkbox state never updated visually. Re-parent all pulled-up children to the actual container node (FilesCategoryNode, PullRequestNode, or CommitNode) so ancestor walks target visible tree nodes.
1 parent 6596ede commit 2660f43

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

src/view/treeNodes/commitNode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export class CommitNode extends TreeNode implements vscode.TreeItem {
111111
dirNode.finalize();
112112
if (dirNode.label === '') {
113113
// nothing on the root changed, pull children to parent
114+
dirNode._children.forEach(child => { child.parent = this; });
114115
result.push(...dirNode._children);
115116
} else {
116117
result.push(dirNode);

src/view/treeNodes/filesCategoryNode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export class FilesCategoryNode extends TreeNode implements vscode.TreeItem {
9393
if (dirNode.label === '') {
9494
// nothing on the root changed, pull children to parent
9595
this.directories = dirNode._children;
96+
this.directories.forEach(child => { child.parent = this; });
9697
} else {
9798
this.directories = [dirNode];
9899
}

src/view/treeNodes/pullRequestNode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export class PRNode extends TreeNode implements vscode.CommentingRangeProvider2
105105
dirNode.finalize();
106106
if (dirNode.label === '') {
107107
// nothing on the root changed, pull children to parent
108+
dirNode._children.forEach(child => { child.parent = this; });
108109
result.push(...dirNode._children);
109110
} else {
110111
result.push(dirNode);

0 commit comments

Comments
 (0)