Skip to content

Optimize review page for fast loading and large PRs#51

Merged
stylessh merged 1 commit intomainfrom
stylessh/review-fast-path
Apr 10, 2026
Merged

Optimize review page for fast loading and large PRs#51
stylessh merged 1 commit intomainfrom
stylessh/review-fast-path

Conversation

@stylessh
Copy link
Copy Markdown
Owner

Summary

  • SSR now only loads PR metadata + file summaries; patch payloads are deferred to client via paginated infinite queries (50 files/page) that load on scroll
  • Diff viewers lazy-render using a single shared IntersectionObserver — PatchDiff only mounts when a block is near the viewport, with automatic fallback from word-diff to line-diff for large patches
  • URL hash updates silently on scroll via replaceState for scroll persistence on reload, with deep-link support for files not yet loaded (auto-fetches pages until target is found)
  • Disables automatic refetch for page/file queries and defers review comment loading until after mount
  • Minor polish: textarea uses bg-background, binary file card inset matches patch header spacing

Test plan

  • Open a large PR (100+ files) — shell should render instantly, patches stream in on scroll
  • Scroll through files — URL hash updates, hard reload preserves scroll position
  • Deep-link to a file far down the list — page fetches and scrolls to it automatically
  • Click sidebar files — navigates correctly for both loaded and not-yet-loaded files
  • Verify word-diff renders on small patches, line-diff on large ones

…croll persistence

- Split SSR to only load PR metadata + file summaries, deferring patch payloads to client
- Add paginated infinite query for patch files (50 per page) with scroll-based loading
- Lazy-render diff viewers via shared IntersectionObserver — only mount PatchDiff when near viewport
- Fall back from word diff to line diff for large patches (>400 changes or >24K chars)
- Disable automatic refetch for page/files queries on the review route
- Defer review comments loading until after mount
- Update URL hash on scroll via replaceState for scroll persistence on reload
- Fix deep-link navigation to files not yet loaded (fetches pages until target is found)
- Fix scroll jank caused by hash handler re-firing on every file load
- Polish: textarea bg-background, binary file card inset to match patch header
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
diffkit 1eb6c6e Commit Preview URL

Branch Preview URL
Apr 10 2026, 04:11 AM

@stylessh stylessh merged commit 60787ba into main Apr 10, 2026
4 checks passed
stylessh added a commit that referenced this pull request Apr 18, 2026
…croll persistence (#51)

- Split SSR to only load PR metadata + file summaries, deferring patch payloads to client
- Add paginated infinite query for patch files (50 per page) with scroll-based loading
- Lazy-render diff viewers via shared IntersectionObserver — only mount PatchDiff when near viewport
- Fall back from word diff to line diff for large patches (>400 changes or >24K chars)
- Disable automatic refetch for page/files queries on the review route
- Defer review comments loading until after mount
- Update URL hash on scroll via replaceState for scroll persistence on reload
- Fix deep-link navigation to files not yet loaded (fetches pages until target is found)
- Fix scroll jank caused by hash handler re-firing on every file load
- Polish: textarea bg-background, binary file card inset to match patch header
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant