Skip to content

fix(web): pull request hover card holds a comment or commit's place while it loads - #37460

Open
flamboh wants to merge 2 commits into
pingdotgg:maria/redesign/1-primitives-shellfrom
flamboh:t3/redesign-pr-preview-comment-commit-cards
Open

flamboh wants to merge 2 commits into
pingdotgg:maria/redesign/1-primitives-shellfrom
flamboh:t3/redesign-pr-preview-comment-commit-cards

Conversation

@flamboh

@flamboh flamboh commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Note

🤖 Claude Opus 5.5 on behalf of Oliver

Change for the redesign stack, targets layer 1 (#28839).
Stacked on #37453: this branch contains that commit, so review #37453 first; the diff here shrinks to its own change once that one lands.

Problem

A hover card for a link to a pull request comment or commit needs a second read for that comment or commit. Until it lands, the card shows the pull request's title and author, then swaps that whole body for the comment or commit, so the card changes content and size under the pointer.

Change

The URL already says whether the link is to a comment or a commit, so from the first frame the card shows a skeleton laid out like that body: author line plus four text lines for a comment (excerpts are clamped to four), a two-line headline plus the sha and author row for a commit. The real content replaces it when the read lands. If the read fails, or the comment or commit is no longer there, the card shows the pull request's title and author as it does today. Links to other timeline events (#event-…) never resolve to a comment, so they keep showing the pull request.

Evidence

Hovering a comment link and a commit link, with the activity read slowed by 1.5 s on both sides. Before (base, #37453's head) the card shows the pull request's title and author, then swaps to the comment or commit and changes size. After, a placeholder of the same shape fills in and the card keeps its size. Loaded, the cards are pixel-identical.

A comment link:

https://gh-file-drop-api-prod-galwoqjslzlnws6s.oliver-boorstein.workers.dev/f/3c0fedbcc7b31ec2/comment-card.mp4

A commit link:

https://gh-file-drop-api-prod-galwoqjslzlnws6s.oliver-boorstein.workers.dev/f/c216173535a254a5/commit-card.mp4

Before and after for a comment link and a commit link, loading and loaded

Measured on the after build: a four-line comment and a two-line commit headline do not move the card at all. A very short comment ("LGTM") shrinks it by 58.5 px once, a 20-character headline shrinks it by 19.25 px, and a 121-character headline grows it by 19.25 px.

Validation

  • Measured in Chromium with the app's CSS: the comment placeholder is the exact height of a comment whose excerpt fills its four lines, and the commit placeholder the exact height of a two-line headline.
  • PullRequestLinkPreview.browser.test.tsx covers the comment and commit placeholders, the #event- link that keeps the pull request, and the fallback when the read fails.
  • vp run check:changed df77ec3054a: format, lint, knip, typecheck, tests and the React compiler check pass.

Made with Claude Opus 5.5 in Claude Code (T3 Code).

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 16, 2026
@flamboh
flamboh marked this pull request as ready for review November 16, 2026 03:47
expect(document.querySelector('[data-slot="skeleton"]')).toBeNull();
});

it.each([

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.

This tests a purely visual layout-shift fix, for which the before/after captures are the required proof. Could you remove the new placeholder and fallback tests, along with the added skeleton assertion in the existing loading test?

Posted via Macroscope — Test Signal

@macroscopeapp

macroscopeapp Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at abed792

Macroscope's review found this PR approvable — Pull-request hover cards now reserve space for linked comments, commits, and timestamps while loading. The change is limited to transient presentation, with existing fetching, navigation, and error fallbacks unchanged.

You can add or adjust custom eligibility rules. Learn more.

This branch has not been deployed

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

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant