Skip to content

perf(course): near-instant IE lesson nav via full-route prefetch#331

Open
iamartyaa wants to merge 1 commit into
mainfrom
perf/course-instant-nav
Open

perf(course): near-instant IE lesson nav via full-route prefetch#331
iamartyaa wants to merge 1 commit into
mainfrom
perf/course-instant-nav

Conversation

@iamartyaa

Copy link
Copy Markdown
Owner

What

Force full-route prefetch on the bounded set of adjacent inference-engineering lesson links: LessonShell topbar Prev/Next + LessonFooter prev/next/up-next. Two files, additive.

Why (mechanism)

The IE lesson route renders dynamically — the root layout's ConvexAuthNextjsServerProvider reads cookies, which forces every route dynamic under Next 16's default model. Consequences for next/link:

Before (prefetch="auto") After (prefetch)
Dynamic route prefetch Only to the loading.tsx boundary Full route, incl. prose
Adjacent-lesson click Streams prose body from server (blank-flash round-trip) Reuses client cache, no round-trip for the body
Client cache n/a Static bucket, 5-min default

So navigating between adjacent lessons no longer waits on a full server round-trip for the static body — the transition is perceptibly faster.

Scope & guardrails

  • Bounded to adjacent links only (prev/next/up-next). The ~100 LessonRail items stay auto — full-route prefetch × 100 dynamic renders would be a prefetch storm.
  • Prose is identical for every viewer, so caching the payload is safe. Server stays authoritative for auth/limits/engagement writes.
  • Not enabling PPR/cacheComponents (build-validated; pnpm build deploys 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).
  • The prefetch={false} links elsewhere are all mcps-branch components — different course, out of scope.

Verification

  • pnpm exec tsc --noEmit — clean
  • pnpm test — 12/12 green
  • pnpm 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 🪄

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>
@vercel

vercel Bot commented Jul 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lainlog Ready Ready Preview, Comment Jul 18, 2026 11:21am

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