Repository navigation
Conversation
A refresh emptied the accumulated diff slices and refetched the first page, but slices were only refilled when the query's data changed identity. An equal refetch keeps the previous value's identity, so the tab showed "no file changes" until the diff's content changed. Read whether a page is already applied from the slices instead of a separate identity gate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 68b4e5a599e3561ddd5a23568bb5183a38fb342c)
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused bug fix that restores an existing pull request diff after an equivalent refresh, with the changed-page behavior preserved and a targeted browser regression test added. It introduces no new capability, schema, product default, deployment change, or static-analysis override. You can add or adjust custom eligibility rules. Learn more. |
This branch has not been deployed
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.
Note
🤖 Claude Sonnet 5.5 writing on behalf of Rodrigo
Problem
The pull request Code tab intermittently shows "This pull request has no file changes." and a "0 files" header for a PR that has changes. It appears a few minutes after the PR opens or after an agent turn, and clears on its own once the diff changes or the tab remounts.
The cause is in
PullRequestCodeTab.tsx. A refresh (the panel'srefreshTokengoes up after a PR sync, an agent turn, or a manual refresh) empties the accumulated diff slices and refetches the first page. The slices were only refilled when the query returned a different data object, cursor or scope. Since #20850, an equal refetch keeps the previous data object, so after the resetdata, the cursor and the scope all match what was already applied and nothing refills the slices. This happens whenever nothing beyond the first page is loaded, which is the normal case for a small or new PR.Change
The tab now decides whether the current page is already applied by looking at the loaded slices, instead of tracking the data object's identity in a separate
appliedPagestate. A refresh shows the first page again right away and replaces it only if its content changed. The rule that a changed page drops the slices after it is unchanged. The existing content comparison became a smallsameSlicehelper used in both places.Scope and approval
Very small, focused fix for an obvious bug, so submitted without a prior issue or discussion: a refresh of an unchanged diff leaves the tab permanently empty. It changes no setting, control or default, and no contract.
Verification
PullRequestCodeTab.browser.test.tsxrenders the real component with the realuseEnvironmentQueryanduseAtomRefresh, loads a one-file diff, bumpsrefreshToken, and has the refetch return the same page object. It expects the file to stay on screen. Onupstream/mainit fails with the "no file changes" message; with this change it passes.vp linton both files and theapps/webtypecheck are clean.Not checked: the fix in a live app, since the empty state cannot be staged without altering state, so there are no screenshots. The test fakes the equal refetch with a stand-in atom rather than the real environment query family. A second suspected path (selecting a commit or update range and switching back before its diff loads) is covered by the same change but has no test.
Written by Claude Opus 5.5 (fix and test) and Claude Sonnet 5.5 (PR) in Claude Code.
🤖 Generated with Claude Code