Fix PR tree reveal errors for flat file layout#8522
Conversation
- 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.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
@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
|
@gvilums could you accept the CLA as in #8522 (comment) ? I want to get this fix out to folks 😁 |
|
@microsoft-github-policy-service agree |
|
/AzurePipelines run |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
Summary
Fixes
PullRequestTreereveal failures that can break the PR diff UI with errors like:Root causes
FilesCategoryNode, but theirparentstayed pointed at hiddenDirectoryTreeNodeinstances.fileAutoRevealwas enforced for active-editor changes, but not for tree visibility changes.FilesCategoryNodechildren were materialized.Changes
FilesCategoryNodewhen rendering flat layout (FilesCategoryNode#getChildren).githubPullRequests.fileAutoRevealinRepositoryChangesNode.Validation
Cannot resolve tree item for element 0/0:rdma.rs