Skip to content

feat(builder): show page skeletons instantly on workspace navigation - #1574

Merged
sung17 merged 1 commit into
mainfrom
feat/workspace-navigation-loading
Oct 28, 2026
Merged

sung17 merged 1 commit into
mainfrom
feat/workspace-navigation-loading

Conversation

@sung17

@sung17 sung17 commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Clicking a sidebar item (Analytics, Inbox, Flows, Contacts…), a tab (Flows / Tags / Custom fields…), a Tools card, or an edit/create action used to leave the old page frozen while the server compiled and rendered the next route. Now the content area switches straight to a skeleton shaped like the destination, the same way the /shop pages already behave.

  • NavigationPendingProvider (components/navigation-pending.tsx) in the workspace layout tracks:
    • in-app <a>/<Link> clicks (plain left click, same origin, under /space/, different pathname).
    • every router.push / router.replace, by re-providing AppRouterContext with push/replace run in a transition, so the skeleton stays until the new route commits. This covers all ~145 call sites (edit buttons, create-then-redirect) with no per-feature edits.
    • Search-param-only navigations (filters, pagination, folders) never trigger it. A 60s safety timeout clears a navigation that never lands.
  • NavigationPendingBoundary hides the current page (it stays mounted) and renders the destination skeleton.
  • AppTab keeps its real tab strip and only skeletons the content below it. Re-clicking the open tab does nothing.
  • Skeletons (components/workspace-skeletons.tsx): inbox, analytics, tabbed list (including every /settings/* page), form (create/edit/record id), flow editor (/flows/<id>), and a plain list page. Route → skeleton mapping is a pure resolveWorkspaceSkeletonKind.
  • dashboard/loading.tsx keeps the inbox cards while switching analytics sub-pages. No workspace-level loading.tsx, so notFound() from section layouts still returns HTTP 404.

Note on AppRouterContext

This imports next/dist/shared/lib/app-router-context.shared-runtime, which is an internal Next export. Verified on Next 16.4.3: router methods are plain functions (no this), and <Link> only null-checks the context. __tests__/navigation-pending.test.tsx uses Next's real useRouter(), so a Next upgrade that breaks this fails CI instead of silently.

Public API

Exempt from invariant 23: this is UI-only plumbing (navigation loading state) with no operation or result to expose.

Test plan

  • pnpm lint
  • pnpm --filter builder check-types
  • vitest run in apps/builder: 1028 files pass, including the new workspace-route-skeleton.test.ts and navigation-pending.test.tsx
  • Dev server: sidebar items, Flows → Tags tabs, Tools cards, Broadcasts edit, Products create-and-save. The skeleton shows immediately during compile/render.
  • Contacts filter/pagination and Flows folder switching do not show the skeleton.
  • Re-clicking the active tab does not cover the content.

🤖 Generated with Claude Code

Clicking a sidebar item, a tab, or an edit/create action used to leave the
old page frozen until the server finished compiling and rendering the next
route. The workspace shell now swaps the content area for a skeleton shaped
like the destination as soon as the navigation starts.

- NavigationPendingProvider tracks in-app link clicks and router.push/replace
  (re-provided AppRouterContext, push/replace run in a transition)
- AppTab keeps its tab strip and only skeletons the content below it
- Route-shaped skeletons: inbox, analytics, tabbed lists, forms, flow editor
- dashboard/loading.tsx keeps the inbox cards while switching analytics tabs

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the feature New feature or request label Oct 28, 2026
@sung17
sung17 merged commit 70d2fd4 into main Oct 28, 2026
15 checks passed
hello-jackytruong referenced this pull request in hello-jackytruong/ChatWorkAI Nov 22, 2026
…(#1574)

Clicking a sidebar item, a tab, or an edit/create action used to leave the
old page frozen until the server finished compiling and rendering the next
route. The workspace shell now swaps the content area for a skeleton shaped
like the destination as soon as the navigation starts.

- NavigationPendingProvider tracks in-app link clicks and router.push/replace
  (re-provided AppRouterContext, push/replace run in a transition)
- AppTab keeps its tab strip and only skeletons the content below it
- Route-shaped skeletons: inbox, analytics, tabbed lists, forms, flow editor
- dashboard/loading.tsx keeps the inbox cards while switching analytics tabs

Co-authored-by: Deathgiver <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant