Skip to content

Fix Files node parent in pull request changes tree#8846

Open
Eiji-Kudo wants to merge 5 commits into
microsoft:mainfrom
Eiji-Kudo:fix/8845-pr-tree-files-reveal
Open

Fix Files node parent in pull request changes tree#8846
Eiji-Kudo wants to merge 5 commits into
microsoft:mainfrom
Eiji-Kudo:fix/8845-pr-tree-files-reveal

Conversation

@Eiji-Kudo

@Eiji-Kudo Eiji-Kudo commented Jul 15, 2026

Copy link
Copy Markdown

Summary

The Changes in Pull Request view can become empty when file auto-reveal asks VS Code to resolve the visible Files category. The category was reporting the root tree provider as its parent instead of the RepositoryChangesNode that directly contains it, so VS Code could not reconstruct the rendered parent chain when the node handle was not cached.

  • Parent the visible Files and Commits category nodes to their rendered RepositoryChangesNode container.
  • Preserve the existing refresh and reveal delegation to the root tree provider through the node chain.
  • Add a regression test for both category parent relationships used by TreeDataProvider.getParent() and TreeView.reveal().

Testing

  • npm run lint
  • npm run compile
  • npm run compile:test
  • Extension test suite: 453 passing

Manual verification

  • Open a checked-out pull request with file auto-reveal enabled, switch away from and back to the GitHub Pull Request view, and confirm the changed-files tree remains populated while the active diff is revealed.

Follow-up issues

None.

Fixes #8845

@Eiji-Kudo
Eiji-Kudo marked this pull request as ready for review July 15, 2026 05:46
Copilot AI review requested due to automatic review settings July 15, 2026 05:46
@Eiji-Kudo

Copy link
Copy Markdown
Author

@codex review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a VS Code tree handle resolution issue in the Changes in Pull Request view by aligning FilesCategoryNode’s parent pointer with its rendered container (RepositoryChangesNode), preventing the tree from becoming empty during auto-reveal when node handles aren’t cached.

Changes:

  • Parent FilesCategoryNode to RepositoryChangesNode to enable TreeDataProvider.getParent() to reconstruct the rendered chain.
  • Add a regression test validating the Files node parent relationship used by getParent() / TreeView.reveal().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/view/treeNodes/repositoryChangesNode.ts Fixes the Files category node parent pointer to match the rendered tree hierarchy.
src/test/view/treeNodes/repositoryChangesNode.test.ts Adds a regression test to validate the parent chain for the Files node.
Comments suppressed due to low confidence (1)

src/view/treeNodes/repositoryChangesNode.ts:116

  • CommitsNode is still constructed with this.parent (the root tree provider), so CommitsNode.getParent() returns undefined even though it is rendered under RepositoryChangesNode. This leaves the same VS Code handle-resolution/reveal failure mode in place for the visible Commits category node.
			this._filesCategoryNode = new FilesCategoryNode(this, this._reviewModel, this.pullRequestModel);
			this._commitsCategoryNode = new CommitsNode(
				this.parent,
				this._pullRequestManager,
				this.pullRequestModel,

Comment thread src/test/view/treeNodes/repositoryChangesNode.test.ts Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 06:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/test/view/treeNodes/repositoryChangesNode.test.ts
Copilot AI review requested due to automatic review settings July 15, 2026 06:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@Eiji-Kudo

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copilot AI review requested due to automatic review settings July 16, 2026 09:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread src/test/view/treeNodes/repositoryChangesNode.test.ts
@alexr00
alexr00 enabled auto-merge (squash) July 16, 2026 09:49

@alexr00 alexr00 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changes in Pull Request tree becomes empty after auto-reveal fails to resolve the Files node

4 participants