Skip to content

feat: structural canvas via route groups (removes usePathname/Suspense)#423

Merged
ignmandagaran merged 2 commits into
ignmandagaran/adopt-cache-componentsfrom
ignmandagaran/canvas-route-groups
Jul 1, 2026
Merged

feat: structural canvas via route groups (removes usePathname/Suspense)#423
ignmandagaran merged 2 commits into
ignmandagaran/adopt-cache-componentsfrom
ignmandagaran/canvas-route-groups

Conversation

@ignmandagaran

@ignmandagaran ignmandagaran commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Replaces the usePathname + BLACKLISTED_PATHS runtime check in ContentWrapper (the last page-level <Suspense> after Cache Components adoption) with a structural route-group approach. Now fully wired and verifiedContentWrapper/usePathname are removed.

Stacked on #422.

Mechanism

  • CanvasLayer — the single 3D canvas, mounted once in the root layout (persists across nav). Visibility driven by store flags, no usePathname → no <Suspense>.
  • Two-flag persistence: isCanvasInPage (sticky — keeps the WebGL Scene mounted across navigations) + canvasVisible (per-route show/hide).
  • SetCanvasMode — a client effect-setter each group layout renders to declare canvas on/off (client-only → no prerender hazard).
  • PageShell — shared <main>+Footer chrome for the (content) sub-layout in both groups.

Structure

(site)/layout.tsx            -> <CanvasLayer/> + {children}
(site)/(canvas)/layout.tsx   -> <SetCanvasMode enabled/> + mt-[100dvh] container
       (content)/            -> <PageShell/>  [home, services, people, blog, showcase index]
       basketball, doom, lab
(site)/(plain)/layout.tsx    -> <SetCanvasMode enabled={false}/>
       (content)/            -> <PageShell/>  [post/[slug], careers/[slug], showcase/[slug]]
       contact

/showcase (canvas) and /showcase/[slug] (plain) split cleanly across groups — Next accepts it.

Verified

  • Build green, 89/89. No usePathname, no ContentWrapper Suspense.
  • Runtime QA (browser): canvas shows on home/services, hides on post (content intact), WebGL canvas stays mounted across plain routes (persistence), re-shows on canvas routes; margin offset correct; no console errors.

Notes / follow-ups

  • lab stays ƒ (its own instant = false user-agent redirect — unrelated to canvas).
  • 404 (not-found.tsx) sets canvas mode directly; the 404-within-a-plain-route path is worth a manual check.
  • This is a sizable diff (route folders moved + 21 import updates) — review the move + import rewrites.

Checklist

  • Build passes (89/89)
  • Tested locally in dev mode (canvas show/hide/persist + nav)
  • No usePathname/page-level <Suspense> for the canvas

Replaces the usePathname + BLACKLISTED_PATHS check with a route-group approach:
- CanvasLayer: the single persistent canvas, mounted once in the root layout,
  visibility driven by the isCanvasInPage store flag (no usePathname).
- SetCanvasMode: client effect setter a group layout renders to declare
  canvas on/off — runs client-side, so no prerender hazard, no <Suspense>.
- PageShell: the (pages) main+Footer chrome, extracted so both the canvas and
  plain groups can share it.

Wiring (route moves + root/layout swap) is the next step; see notes.
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
website-2k25 Ready Ready Preview, Comment Jun 26, 2026 7:23pm

Replace ContentWrapper's usePathname + BLACKLISTED_PATHS with route groups:
- (canvas)/ and (plain)/ groups; (content)/ sub-layout shares PageShell chrome
- root layout mounts the persistent CanvasLayer (no usePathname, no Suspense)
- SetCanvasMode in each group layout toggles canvasVisible; isCanvasInPage stays
  sticky so the WebGL Scene persists across navigations
- showcase index (canvas) / [slug] (plain) split across groups
- not-found sets canvas mode; 21 cross-refs + contact path updated

Build green (89/89). Runtime canvas behavior pending browser QA.
@ignmandagaran ignmandagaran changed the title prototype: structural canvas via route groups (RFC) feat: structural canvas via route groups (removes usePathname/Suspense) Jun 26, 2026
@ignmandagaran ignmandagaran marked this pull request as ready for review July 1, 2026 18:15
@ignmandagaran ignmandagaran merged commit 317c8b8 into ignmandagaran/adopt-cache-components Jul 1, 2026
3 checks passed
@ignmandagaran ignmandagaran deleted the ignmandagaran/canvas-route-groups branch July 1, 2026 18:15
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