Skip to content

feat(web): bootstrap workspace from URL on first paint#84

Draft
kumarabhirup wants to merge 2 commits into
mainfrom
feat/instant-url-boot
Draft

feat(web): bootstrap workspace from URL on first paint#84
kumarabhirup wants to merge 2 commits into
mainfrom
feat/instant-url-boot

Conversation

@kumarabhirup

Copy link
Copy Markdown
Collaborator

Summary

  • extract shared workspace tree, context, object, and app loaders so the server can resolve initial workspace state without calling internal API routes
  • bootstrap app/page.tsx from searchParams and pass an initialSnapshot into the client shell so the first paint opens the correct file, object, app, browse view, or chat route
  • seed workspace-content.tsx and use-workspace-watcher.ts from that snapshot so reloads stop flashing the home hero and the watcher skips the redundant first fetch
  • replace the legacy client-side /workspace redirect with a server redirect while preserving deep-link query params

Why

The workspace currently renders the Home tab first and only later hydrates into the URL-selected content after fetching the tree and then fetching the payload. This change makes the incoming URL the source of truth for first paint so reloads and deep links open in one pass.

Journey

Approaches considered and decisions made
  • Chosen approach: server bootstrap snapshot instead of gating first paint behind a spinner, so the app shows the correct route immediately instead of just hiding the flash.
  • Key decision: extract reusable loaders from the API routes instead of calling internal HTTP endpoints from page.tsx, which keeps server boot and API responses in sync.
  • Gotcha addressed: hidden-file and browse deep links were previously blocked behind the initial tree fetch and could resolve incorrectly on first load.

Test plan

  • Reload /?path=company and confirm the company view renders on first paint with the correct active tab
  • Reload an app route and confirm the app loads without flashing the brand-new-chat hero first
  • Reload a browse route and a hidden=1 deep link and confirm both resolve on first paint
  • Verify live tree updates still arrive after mount via the existing watcher/SSE flow

This seeds the workspace shell from server-loaded route data so reloads land on the correct tab and content immediately instead of flashing home first.
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