perf(design-systems): speed up preview loading - #7080
Conversation
|
Thanks @kuigoo — the hover-intent + shared-read direction is clearly scoped from the PR body, especially the red/green verification around preview churn. Since this PR is currently marked as a draft, we'll hold off on detailed review until it's ready for review. 💡 To drive this PR to merge hands-free, paste this to your AI coding agent (Claude Code / Codex / opencode / Cursor …): |
|
Thanks for marking this ready, @kuigoo. Since this changes user-facing preview behavior, I’m flagging it for a manual QA pass before merge — please hold off self-merging for now; we’ll loop QA in once it’s merge-ready. |
mrcfps
left a comment
There was a problem hiding this comment.
@kuigoo thanks for the careful perf work here — this is a solid fix for the design-system picker thrash.
I reviewed the changed ranges across web + daemon: hover/focus intent debouncing in DesignSystemPicker, shared cancellable detail/preview/showcase reads with generation fencing and write invalidation in registry.ts, controlled detail handoff in the kit preview/modal, and the bundled single-ID summary fast path on the daemon detail route. The red/green picker intent specs and the coalescing/abort/stale-fence coverage match the behavior I traced, and I did not find correctness, safety, or maintainability issues that should block merge.
Nice measurement-backed win (8 → 2 detail attempts under the simulated scan) without changing the visible controls.
🔁 Powered by Looper · runner=reviewer · agent=opencode · An autonomous AI dev team for your GitHub repos.













































Fixes #7079
Why
I hit this while browsing bundled design-system presets locally: on a slower daemon or filesystem, moving through the picker repeatedly replaced the preview pane with a loading state.
The picker promoted every transient hover/focus target immediately. Overlapping preview consumers could then repeat the same detail read, while bundled detail resolution still paid for a catalog scan. Besides making the picker feel slow, the existing read path also allowed a write-after-read race to surface stale editable content.
This PR keeps quick browsing cheap without weakening freshness after design-system mutations.
What users will see
Under the same local production build and 300 ms simulated detail latency, rapidly scanning eight official presets reduced measured detail HTTP attempts from 8 to 2.
Surface area
apps/weborapps/desktop(including Electron menu bar)odsubcommand or flag, newtools-dev/tools-packflag, or newOD_*env var/api/*endpoint, new SSE event, or changed shape inpackages/contractsskills/,design-systems/,design-templates/, orcraft/, or change to the skills protocolTRANSLATIONS.mdfor the locale workflow)package.json(dependenciesordevDependencies); workspace-packagepackage.jsonfiles are out of scope. Include a paragraph on what we get vs. what bytes we ship (seeCONTRIBUTING.md→ Code style)Screenshots
The comparison visualizes the measured scan on the same captured UI with 300 ms simulated latency on
GET /api/design-systems/:id. The request counters come from the proxy measurement; the row traversal is slowed so the behavior is readable.Bug fix verification
apps/web/tests/components/DesignSystemPicker.test.tsxmain: yes — both the hover and keyboard-focus intent specs fail becausefetchDesignSystemis called before 119 ms elapses.apps/web/tests/design-system-preview-performance.test.tscovers coalescing, abort behavior, cache lifetime, fresh reads, write invalidation, and stale in-flight fencing;apps/daemon/tests/design-systems/detail-summary-fast-path.test.tscovers the single-ID bundled fast path.Validation
pnpm guardpnpm typecheckpnpm --filter @open-design/web buildpnpm --filter @open-design/daemon buildDesignSystemPicker.test.tsx -t 'waits for hover intent|applies preview intent'— 2 failed onmain, 2 passed on this branchairbnbreturned 200 while non-canonicalAirbnb/AIRBNBreturned 404