Vibeleaderboard
← All Intel
Intel / blog

Rendering huge pull requests in the GitHub Copilot app

Source
github.blog
Author
Alberto Gimeno
Date

Context

GitHub rebuilt its Copilot app's pull-request view around a problem that code-only displays avoid: review comments change height as people expand sections, load images or write replies. Its engineering account explains why estimating every comment's height produced gaps, clipping and scroll jumps.

The revised view tracks predictable code-row heights separately from variable comment heights. It renders only the nearby content, measures comments as needed and preserves the reader's position when those measurements change. This lets a large review remain a continuous conversation without requiring every line and comment to be rendered at once.

Key takeaways · AI-distilled
  • GitHub's Copilot app keeps code diffs fast with virtualization built on a rule that every code row's height is known before paint; review comments break that rule because their height is only known after rendering.
  • The fix splits geometry in two: an exact, prefix-summed code-height index that never rebuilds, plus a separate index of comment blocks keyed by identity and file/line anchor, holding measured, cached, or estimated heights.
  • GitHub rejected one ResizeObserver per block writing heights back, since that creates a feedback loop. Instead a single idle, scroll-gated pass measures blocks within about 2,400px of the viewport; observers by default only flag blocks for re-measurement.
  • Scroll corrections are anchored by identity: capture the row or block the user is looking at, apply height changes, then restore that anchor. A bug arose when the surface's own programmatic scrolls were mistaken for user scrolling.
  • Bugs were found with an unattended change, measure, improve loop: permanent in-app probes (mounted rows, frame cost, correction sizes, observer teardown) asserted as budgets in CI, plus an autopilot driving the real app through a huge PR.
Read the source github.blog
Recommended reads
Comments

Checking sign-in…

Loading comments…