Skip to content

perf(workbench): load route views on first visit - #2392

Merged
DeliciousBuding merged 1 commit into
masterfrom
perf/lazy-workbench-routes
Oct 19, 2026
Merged

DeliciousBuding merged 1 commit into
masterfrom
perf/lazy-workbench-routes

Conversation

@DeliciousBuding

Copy link
Copy Markdown
Collaborator

Summary

Rail pages (agents / contacts / projects / runs / docs / devices / usage / settings) were statically imported into the workbench entry chunk, so every boot paid for all eight even when the user only used chat. They are now React.lazy chunks behind a single Suspense boundary; route hooks stay mounted in WorkbenchRoutes, so in-progress drafts and project caches still survive navigation.

Also removes the 40-line rationale block that had grown above the route gates (the invariant is one sentence) and drops leftover blank lines in the web i18n bootstrap.

Bundle (web, vite build --sourcemap)

chunk before after
entry raw 1401 KB 1117 KB (−20%)
entry gzip 412 KB 347 KB (−16%)
on-demand — agents 191 KB, contacts 28 KB, settings 25 KB, projects 25 KB, tasks 22 KB, docs 11 KB, devices 6 KB, usage 5 KB

Test harness

Rail navigation in tests goes through a new openRailPage() helper that warms the route modules in beforeAll and flushes the lazy chunk inside act(), so existing synchronous assertions stay valid without weakening them.

Verification

  • workbench vitest: 163 files / 1605 tests pass
  • desktop vitest: 365 files / 4881 tests pass
  • web vitest: 33 files / 275 tests pass
  • tsc -b (shared, workbench, web) and tsc --noEmit (workbench): clean
  • pnpm lint:css + workbench eslint: 0 errors
  • python scripts/verify/verify-doc-ssot.py: ok
  • scripts/visual-qa-shell.mjs: 4 shots, overflow=false
  • Manual browser check of the lazy /tasks route renders the board shell

Not covered: scripts/visual-qa-tasks-board.mjs fails on master as well — the script still pins real-data mode and expects fixture board columns; unrelated to code splitting (the page itself renders).

The eight rail pages were statically imported into the entry chunk, so
every boot downloaded agents/settings/projects/contacts/tasks/docs even
when the user only read chat.

- wrap each route view in React.lazy with a shared Suspense boundary;
  hooks stay mounted in WorkbenchRoutes so drafts and caches survive
  navigation
- replace the 40-line rationale block with a two-line invariant
- drop leftover blank lines in the web i18n bootstrap
- tests navigate through a new openRailPage helper that flushes the lazy
  chunk inside act(), so assertions stay synchronous

Web build (raw / gzip):
  entry  1401 KB / 412 KB  ->  1117 KB / 347 KB
  routes now load on demand: agents 191 KB, contacts 28 KB,
  settings 25 KB, projects 25 KB, tasks 22 KB, docs 11 KB,
  devices 6 KB, usage 5 KB

Co-authored-by: Codex <codex@delicious233.com>
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: TokenDanceLab/AgentHub/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 37cd818a-1c0d-484f-a4a3-778f14c94a70

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@DeliciousBuding
DeliciousBuding merged commit 16a0783 into master Oct 19, 2026
34 checks passed
@DeliciousBuding
DeliciousBuding deleted the perf/lazy-workbench-routes branch October 19, 2026 19:26
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