Skip to content

🐡🐋 ↝ [uzm1um ++]: New layout, new font, new research system#224

Merged
Gizmotronn merged 17 commits intomainfrom
minimal-next-level
Apr 27, 2026
Merged

🐡🐋 ↝ [uzm1um ++]: New layout, new font, new research system#224
Gizmotronn merged 17 commits intomainfrom
minimal-next-level

Conversation

@Gizmotronn
Copy link
Copy Markdown
Member

No description provided.

Gizmotronn and others added 17 commits April 2, 2026 19:57
- game/page.tsx: use getUser() (server-validated) instead of getSession()
  (cached/stale), call getGamePageDataForUser() directly to eliminate
  double-auth that caused 408 timeout for new OAuth users on Vercel
- layout.tsx: self-host Syne Mono woff2 to remove Google Fonts build-time
  network dependency
- Fix TypeScript errors across NextScene, aavso, FinishProfile, ProfileSetup,
  test files, tsconfig vitest globals conflict
- Onboarding: localStorage step persistence (ob5), satellite tutorial wiring (ob6),
  mobile InteractiveTutorial overlay fix

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The game page was running 13+ Prisma queries server-side on every cold
start, consistently hitting Vercel's 10s function timeout. Auth was
correct but the data load was the actual kill shot.

Now: server component only auth-gates (getUser, fast), passes null
initialData. GameClient detects null and immediately fetches via the
existing /api/gameplay/page-data route, showing a skeleton meanwhile.
Subsequent refreshes work the same as before.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Server Components cannot write cookies. When getUser() refreshes an
expired OAuth token it calls setAll() which Next.js blocks in SC
context, throwing and producing the 408.

Fix: middleware now owns the Supabase client + getUser() call so token
refresh cookie writes happen on the response (middleware CAN do this).
game/page.tsx uses getSession() — reads the already-refreshed cookie,
no network call, no writes, cannot throw.

Ref: https://supabase.com/docs/guides/auth/server-side/nextjs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two bugs causing the 408:

1. Middleware was returning a plain NextResponse.redirect() when sending
   users to /game. Any cookies refreshed by getUser() lived on
   supabaseResponse but were thrown away. Browser made the next request
   with stale tokens. Server component tried to refresh them, setAll()
   threw (Server Components cannot write cookies), 408.
   Fix: redirectWithCookies() copies supabaseResponse cookies onto every
   redirect response so the browser always gets the updated tokens.

2. createBrowserClient (@supabase/ssr) uses PKCE by default. Without
   /auth/callback to exchange the OAuth code, new Google logins never
   produced a server-readable session.
   Fix: added src/app/auth/callback/route.ts with exchangeCodeForSession.

Also: update Supabase redirect URL in dashboard to
<site>/auth/callback for PKCE to complete.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- layout.tsx: revert to next/font/google (Vercel builds have DNS;
  local DNS broken so local builds failed with localFont anyway)
- page-data route: add stack trace logging so Vercel function logs
  show the exact query/line causing the 500

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Member Author

@Gizmotronn Gizmotronn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests passed, as of the last commit AFAIk

@github-actions
Copy link
Copy Markdown
Contributor

\n## Coverage Report\n\n- Code Coverage: **28.3%**\n- SDD Coverage: **0.0%** (0/6 linked tasks)\n\n_Generated by `coverage-badges` workflow._

@Gizmotronn Gizmotronn merged commit 85c26ce into main Apr 27, 2026
15 of 16 checks passed
@Gizmotronn Gizmotronn deleted the minimal-next-level branch April 27, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant