Skip to content

Migrate data loading to Server Components - #3

Merged
Zaid-maker merged 1 commit into
mainfrom
feat/server-component-data-loading
Jul 18, 2026
Merged

Migrate data loading to Server Components#3
Zaid-maker merged 1 commit into
mainfrom
feat/server-component-data-loading

Conversation

@Zaid-maker

Copy link
Copy Markdown
Owner

Summary

The big architectural change from the frontend analysis: migrate initial data loading from client-side useEffect fetching to Server Components. Pages now fetch data server-side and hydrate the Zustand store, so the per-navigation loading spinners are gone and content is server-rendered.

Before

Every authenticated page was ''use client'' and fetched its data in useEffect after mount -> a spinner on every navigation ("Loading Dashboard...", "Opening board...", "Synchronizing..."), request waterfalls, no SSR.

After

  • Dashboard / Board / Calendar pages are now async Server Components that fetch server-side and pass data down.
  • Thin client hydrators (DashboardClient, BoardClient) seed the store synchronously before the interactive components render. BoardClient is keyed by boardId (remount + re-seed on board switch) and upserts the board record so the Navbar title works on direct deep-links.
  • Calendar split into a server page + CalendarView client component (deadlines serialized to ISO strings for stable parsing).
  • Layout is now a Server Component doing the auth check server-side, rendering a new AppShell client component - removes the isPending shell spinner. Navbar takes user as a prop instead of useSession, so the header is correct during SSR.
  • Dashboard receives currentUserId from the server so the owned/shared split is correct on first paint (avoids a hydration mismatch).
  • Added getBoard(boardId) server action for single-board fetches.

Route table after build

ƒ /board/[boardId]     server-rendered on demand
ƒ /calendar            server-rendered on demand
ƒ /dashboard           server-rendered on demand

(previously client-only shells)

Verification

  • next build -> compiles all 7 routes, collects page data successfully
  • tsc --noEmit -> exit 0
  • Dev server boots clean; /, /login, /signup -> 200; /dashboard, /calendar, /board/:id -> 307 -> /login (proxy + server-side auth guard both active)

Notes

  • proxy.ts edge guard is kept as first-line defense; the server layout adds a second server-side check.
  • Mutations remain client-side/optimistic through the store as before.

Generated with Claude Code

Convert the authenticated pages from client-side useEffect fetching to
Server Components that fetch initial data and hydrate the Zustand store,
eliminating the per-navigation loading spinners and enabling SSR.

- Dashboard, board, and calendar pages are now async Server Components that
  fetch data server-side (getBoards / getBoard + getBoardData + members /
  getCalendarCards) and pass it down.
- Add thin client hydrators (DashboardClient, BoardClient) that seed the
  store synchronously before the interactive components render. BoardClient
  is keyed by boardId so switching boards remounts and re-seeds; it also
  upserts the board record so the Navbar title works on direct deep-links.
- Split the calendar into a server page + CalendarView client component
  (deadlines serialized to ISO strings for stable client parsing).
- Convert the authenticated layout to a Server Component that performs the
  auth check server-side and renders a new AppShell client component,
  removing the isPending shell spinner. Navbar takes the user as a prop
  instead of useSession so the header is correct during SSR.
- Dashboard accepts currentUserId from the server so the owned/shared split
  is correct on first paint (no hydration mismatch).
- Add getBoard(boardId) server action for single-board fetches.

Verified: next build compiles all routes; dashboard/board/calendar are now
server-rendered on demand. tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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)
flowee Ready Ready Preview, Comment Jul 18, 2026 5:03pm

@Zaid-maker
Zaid-maker merged commit 820a8a7 into main Jul 18, 2026
3 checks passed
@Zaid-maker
Zaid-maker deleted the feat/server-component-data-loading branch July 18, 2026 17:05
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