Skip to content

Server-side render demo chunks for guest users' first page view #66

Description

@suguanYang

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

  1. User visits the notebook page as a guest
  2. The sources panel shows demo documents (titles only)
  3. Chunks are fetched client-side via /api/sources/{id}/chunks route, which reads from static demo files
  4. User sees a loading spinner while chunks load

Proposed change

  1. During SSR for guest users, call demoData.loadChunksForSource() for the first/default source
  2. Pass the pre-loaded chunks as initial data prop to WorkspaceShell
  3. Use SWR fallback data pattern to skip the client-side fetch when server data is available
  4. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions