Skip to content

perf(web): reduce design-system preview request churn #7079

Description

@kuigoo

Problem

Browsing bundled design systems from the home composer can feel sluggish on a slower daemon or filesystem. The picker eagerly resolves a full design-system detail for transient hover/focus states, and overlapping consumers can repeat the same read.

With a local production build and 300 ms simulated latency on GET /api/design-systems/:id, rapidly scanning the first eight official presets produced eight detail HTTP attempts and repeatedly replaced the preview pane with a loading state.

Reproduction

  1. Run pnpm tools-dev run web --prod --no-env-file.
  2. Open the design-system picker from the home composer.
  3. Add 300 ms latency to GET /api/design-systems/:id.
  4. Move quickly through the first eight official presets without selecting one.

Expected behavior

  • Transient hover/focus states should not start a detail read.
  • A stable preview target should load once, even when multiple consumers request it concurrently.
  • Bundled preset details should be reusable during the browsing burst.
  • Editable systems must still show fresh content immediately after a write.
  • Reading one bundled detail should not require parsing the full design-system catalog.

Proposed scope

  • Add a short shared hover/focus intent before activating the preview.
  • Coalesce overlapping detail, preview, and showcase reads.
  • Cache immutable bundled details briefly while keeping editable-system reads fresh.
  • Invalidate and fence in-flight detail reads after successful mutations.
  • Resolve bundled detail summaries directly with canonical, case-sensitive IDs.

Verification targets

  • A red-on-main/green-on-branch test for hover/focus intent.
  • Registry tests for coalescing, abort behavior, cache lifetime, write invalidation, and stale in-flight fencing.
  • Daemon tests proving single-ID reads avoid a catalog scan and reject non-canonical casing.
  • Local before/after measurement under the same simulated latency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions