Summary
Guest users currently see an empty chunks panel on first visit. The demo document chunks are loaded client-side via SWR only after the page renders, creating a visible loading state and poor first impression.
Since demo data is identical for all guest users, we can load it server-side during page render and deliver it with the initial HTML. This eliminates the loading state and shows parsed content immediately.
Current behavior
- User visits the notebook page as a guest
- The sources panel shows demo documents (titles only)
- Chunks are fetched client-side via
/api/sources/{id}/chunks route, which reads from static demo files
- User sees a loading spinner while chunks load
Proposed change
- During SSR for guest users, call
demoData.loadChunksForSource() for the first/default source
- Pass the pre-loaded chunks as initial data prop to
WorkspaceShell
- Use SWR fallback data pattern to skip the client-side fetch when server data is available
- The chunks data is inherently cacheable (same for all guests, read from static files)
Acceptance criteria
- Guest users see parsed chunks immediately on page load (no loading spinner)
- The existing citation click and source switching still works
- Authenticated user flow is unchanged
- Build passes and type-checks cleanly
Summary
Guest users currently see an empty chunks panel on first visit. The demo document chunks are loaded client-side via SWR only after the page renders, creating a visible loading state and poor first impression.
Since demo data is identical for all guest users, we can load it server-side during page render and deliver it with the initial HTML. This eliminates the loading state and shows parsed content immediately.
Current behavior
/api/sources/{id}/chunksroute, which reads from static demo filesProposed change
demoData.loadChunksForSource()for the first/default sourceWorkspaceShellAcceptance criteria