Repository navigation
Clear cached PR file changes when the base branch changes - #9150
Draft
Alex Ross (alexr00) with Copilot wants to merge 2 commits into
Draft
Alex Ross (alexr00) with Copilot wants to merge 2 commits into
Alex Ross (alexr00) with Copilot wants to merge 2 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix PR file list keeps old base after branch change
Clear cached PR file changes when the base branch changes
Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a PR's base branch is changed outside VS Code (e.g.
gh pr edit --base), Refresh still shows its files compared against the old base. Only a window reload fixes it.Refresh updates the existing
PullRequestModelin place throughcreateOrUpdatePullRequestModel()→update().doUpdate()stored the newbasebut kept_fileChangesand_rawFileChangesCache, which were computed against the old base. These callers reuse the cache whenever it's non-empty:getChangeModels()PRNode.resolveFileChangeNodes()for the checked-out PRrawFileChanges ?? getRawFileChangesInfo()Changes
PullRequestModel.doUpdate(): when the base ref or sha changes (the existingchanges.basecheck), clear both caches so the next read fetches the files again against the new base. TheshowChangesSinceReviewsetter already clears_fileChangesthe same way.Test (
pullRequestModel.test.ts): loads a PR's files against the old base (old.tsdeleted,new.tsadded), updates the base, and asserts thatgetChangeModels()now returns a single rename and thatmergeBaseis the new base sha.Not changed, for reviewers
fileChangeschangesreviewManager's focus behavior: when it's empty, the description opens instead of the changed files.mergeBaseisn't cleared.createReviewCommentThreadneeds it for the active PR, andgetRawFileChangesInfo()recomputes it on every fetch.createConflictResolutionModel/getUpdateBranchFilesreadfileChangeswithout loading it first, which was already the case. If the cache is empty, update-branch fails with "no resolutions provided" and nothing is lost.