Skip to content

Fix PR tree reveal errors for flat file layout#8522

Merged
alexr00 merged 2 commits intomicrosoft:mainfrom
gvilums:fix/pr-tree-reveal-flat-layout
Feb 17, 2026
Merged

Fix PR tree reveal errors for flat file layout#8522
alexr00 merged 2 commits intomicrosoft:mainfrom
gvilums:fix/pr-tree-reveal-flat-layout

Conversation

@gvilums
Copy link
Contributor

@gvilums gvilums commented Feb 16, 2026

Summary

Fixes PullRequestTree reveal failures that can break the PR diff UI with errors like:

Cannot resolve tree item for element 0/0:rdma.rs

Root causes

  1. In flat file layout, file nodes are rendered as direct children of FilesCategoryNode, but their parent stayed pointed at hidden DirectoryTreeNode instances.
  2. fileAutoReveal was enforced for active-editor changes, but not for tree visibility changes.
  3. Reveal could run before FilesCategoryNode children were materialized.

Changes

  • Re-parent file nodes to FilesCategoryNode when rendering flat layout (FilesCategoryNode#getChildren).
  • Gate visibility-triggered reveal behind githubPullRequests.fileAutoReveal in RepositoryChangesNode.
  • Skip reveal attempts until files have been initialized.

Validation

  • Reproduced repeatedly in Remote SSH with extension logs showing:
    • Cannot resolve tree item for element 0/0:rdma.rs
  • Built and installed patched VSIX; verified the extension host loaded the patched bundle.
  • Confirmed the error no longer reproduced in the same environment.

- Re-parent file nodes to FilesCategoryNode when rendering flat layout so tree handles stay consistent.

- Honor fileAutoReveal on tree visibility changes and guard reveal until Files node is initialized.

- Avoid reveal calls when a file node is already attached to the tree root parent.
Copilot AI review requested due to automatic review settings February 16, 2026 06:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes reveal failures in the Pull Request tree view that occurred when using flat file layout, which could break the PR diff UI with "Cannot resolve tree item" errors.

Changes:

  • Re-parents file nodes to FilesCategoryNode in flat layout to align parent pointers with rendered hierarchy
  • Gates visibility-triggered auto-reveal behind the fileAutoReveal setting
  • Prevents reveal attempts before FilesCategoryNode is initialized

Reviewed changes

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

File Description
src/view/treeNodes/filesCategoryNode.ts Re-parents file nodes to FilesCategoryNode in flat layout to fix parent pointer mismatch
src/view/treeNodes/repositoryChangesNode.ts Extracts isFileAutoRevealEnabled helper, gates visibility-triggered reveal, and adds initialization check

@alexr00 alexr00 added this to the February 2026 milestone Feb 16, 2026
@alexr00 alexr00 enabled auto-merge (squash) February 16, 2026 10:41
Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

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

@gvilums, thank you for the PR! As a small token of our appreciation you can claim some VS Code swag here by signing in with GitHub: https://app.brilliantmade.com/r/VS%20Code/micro3ggh85p3

@alexr00
Copy link
Member

alexr00 commented Feb 16, 2026

@gvilums could you accept the CLA as in #8522 (comment) ? I want to get this fix out to folks 😁

@gvilums
Copy link
Contributor Author

gvilums commented Feb 16, 2026

@microsoft-github-policy-service agree

@alexr00
Copy link
Member

alexr00 commented Feb 17, 2026

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@alexr00 alexr00 merged commit 868b6cb into microsoft:main Feb 17, 2026
3 checks passed
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.

3 participants