perf(course): near-instant IE lesson nav via full-route prefetch#331
Open
iamartyaa wants to merge 1 commit into
Open
perf(course): near-instant IE lesson nav via full-route prefetch#331iamartyaa wants to merge 1 commit into
iamartyaa wants to merge 1 commit into
Conversation
The IE lesson route renders dynamically (root layout's Convex-auth provider reads cookies), so Link's default prefetch="auto" only prefetches to the loading.tsx boundary — clicking prev/next then streams the prose body from the server (the blank-flash round-trip). Force full-route prefetch on the bounded set of adjacent destinations (LessonShell topbar Prev/Next + LessonFooter prev/next/up-next) so the whole payload — including prose — is prefetched on hover/viewport and cached in the client static bucket (5-min default). The click then reuses cache with no server round-trip for the body. Rail links (~100) stay auto to avoid a prefetch storm. Prose is identical for all viewers, so caching the payload is safe; server stays authoritative for auth/limits/engagement writes. Highest-leverage tactic: no PPR/cacheComponents (build-validated, build is forbidden here) and no auth-read move (root layout already forces dynamic). Pure Link-prefetch mechanism. Note: repo has 164 pre-existing lint errors in unrelated files; this change adds zero (verified by stash-compare). 🌀 Magic applied with Wibey CLI 🪄 (https://wibey.walmart.com/cli) Co-Authored-By: Wibey CLI <genai-coding-assistants@walmart.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
What
Force full-route prefetch on the bounded set of adjacent inference-engineering lesson links:
LessonShelltopbar Prev/Next +LessonFooterprev/next/up-next. Two files, additive.Why (mechanism)
The IE lesson route renders dynamically — the root layout's
ConvexAuthNextjsServerProviderreads cookies, which forces every route dynamic under Next 16's default model. Consequences fornext/link:prefetch="auto")prefetch)loading.tsxboundarySo navigating between adjacent lessons no longer waits on a full server round-trip for the static body — the transition is perceptibly faster.
Scope & guardrails
LessonRailitems stayauto— full-route prefetch × 100 dynamic renders would be a prefetch storm.cacheComponents(build-validated;pnpm builddeploys Convex to prod, so it's forbidden here) and not moving the auth read (root layout already forces dynamic — a page-level split can't make the prose static).prefetch={false}links elsewhere are all mcps-branch components — different course, out of scope.Verification
pnpm exec tsc --noEmit— cleanpnpm test— 12/12 greenpnpm lint— repo has 164 pre-existing errors in unrelated files (use-media-query.ts, etc.); this change adds zero (verified by stash-compare: 230/164/66 identical with and without the edits). Unrelated files were intentionally not touched.🌀 Magic applied with Wibey CLI 🪄