fix: window syllabus grid rows and drop eager prefetch#466
Draft
posthog-eu[bot] wants to merge 2 commits into
Draft
fix: window syllabus grid rows and drop eager prefetch#466posthog-eu[bot] wants to merge 2 commits into
posthog-eu[bot] wants to merge 2 commits into
Conversation
The /syllabus page renders the entire catalog at once, with every row as a
Next <Link prefetch>. On large catalogs that means mass route prefetching plus
a heavy hydration/render pass that blocks the main thread, so taps on rows go
unanswered for tens of seconds (observed as rage-clicks) before navigation
finally kicks in.
- Render only a window of the result set (48 rows, revealing more via an
IntersectionObserver sentinel) so the main thread isn't blocked hydrating
thousands of rows. The window resets on search; client-side filtering still
runs over the full list.
- Drop eager per-row prefetch (prefetch={false}) and prefetch on hover/focus
via router.prefetch instead, matching the pattern used in course-search.
- Memoize SyllabusRow so selection changes only re-render affected rows.
Generated-By: PostHog Code
Task-Id: b4f39c01-0934-4475-9755-209bd5eccbc8
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Addresses two Greptile review findings: - Reset visibleCount synchronously during render (via a tracked previous-query state) instead of in an effect, so a new search never commits with a stale, large window that would briefly mount hundreds of rows. - Fall back to rendering all rows when IntersectionObserver is unavailable (older embedded WebViews) rather than throwing and leaving the catalog truncated at the initial window. Generated-By: PostHog Code Task-Id: b4f39c01-0934-4475-9755-209bd5eccbc8
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.
Summary
The Syllabus Repository (
/syllabus) rendered the entire catalog in one pass —getAllSyllabi()returns every row andSyllabusGridrendered each as a Next<Link prefetch>. On large catalogs that combines mass route prefetching with a heavy hydration/render pass that blocks the main thread, so taps on rows stay unresponsive for tens of seconds (surfacing as rage-clicks) before navigation finally happens. There were no thrown exceptions — this is a performance/UX problem.This PR keeps the instant client-side search intact while cutting the main-thread work:
IntersectionObserversentinel as the user scrolls. The window resets on search; filtering still runs over the full list.prefetch={false}plus hover/focusrouter.prefetch, matching the existing pattern incourse-search.tsx, so we no longer fire prefetches for the whole catalog on load.SyllabusRowso selection changes only re-render the affected rows.Why
Two independent session recordings on the
/syllabusbrowse flow showed repeated rage-clicks and dozens of rapid dead clicks on syllabus rows, with navigation only succeeding 20–90s later — a repeatable degradation of a core content-discovery flow.Verification
tsc --noEmitpasses on the changed file (remaining errors are pre-existing, repo-wide missing generated.svg/.jsontype declarations produced bynext dev). A live before/after could not be reproduced in the sandbox — no PostgreSQL server binary and no build/OAuth setup available — so this was not exercised against a running instance; the change directly targets the two root causes identified from the session recordings.Created with PostHog Code from an inbox report.
spent a lot of water and tokens to review your slop
Greptile Summary
This PR reduces initial work in the syllabus catalog. The main changes are:
IntersectionObserver.Confidence Score: 5/5
This looks safe to merge.
The search window now resets before the updated results commit. Browsers without
IntersectionObserverno longer crash or leave the catalog truncated.No blocking issues remain in the changed code.
What T-Rex did
Important Files Changed
Reviews (2): Last reviewed commit: "fix: reset syllabus window during render..." | Re-trigger Greptile