Skip to content

perf(ui): add comark-ui/vue/lazy, which loads each block's package on first use - #434

Merged
vite-hub[bot] merged 4 commits into
mainfrom
perf/vue-lazy-components
Nov 15, 2026
Merged

vite-hub[bot] merged 4 commits into
mainfrom
perf/vue-lazy-components

Conversation

@onmax

@onmax onmax commented Nov 14, 2026

Copy link
Copy Markdown
Owner

A Vue page that renders a parsed document with components from comark-ui/vue downloads every block package, even when the page has no block. On vitehub.dev that is about 600 kB of JS (about 196 kB gzip) on each docs page. comark-ui/vue imports all 34 comark-*/vue entries at the top, so the bundler can't split them out.

This adds comark-ui/vue/lazy, which exports the same components map. Each tag is a defineAsyncComponent that imports its package's Vue entry the first time a document renders it. Vue's server renderer waits for them, so a server render still arrives drawn. The Mermaid wrapper and the typeset styles moved into src/vue-blocks.ts, so both entries share them without the lazy one importing vue.ts. comark-ui/vue doesn't change.

The new test in ui.test.ts checks three things: the lazy map has the same tags as comark-ui/vue, the test document renders the same server HTML with both maps, and a build of the lazy entry loads no block package until a page asks for one. Vue numbers useId ids with one more segment under an async component, the same on the server and the client, so the HTML check ignores tab ids. When I added an eager import "comark-carousel/vue" to the lazy entry, the test failed.

The tags are listed by hand, so a package that adds a component needs a line in vue-lazy.ts; the tag test fails until it has one. The 600 kB number comes from vite-hub/vitehub#4366, which builds the same map at build time in @vite-hub/docs. Once a release has this, that PR can import comark-ui/vue/lazy instead. I haven't measured this entry in a real app yet.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-14T20:59:10.577163Z
We couldn’t complete this review. Comment @codex review to try again.
f134f38 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@pkg-pr-new

pkg-pr-new Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

pnpm add https://pkg.pr.new/comark-annotate@434

comark-badge

pnpm add https://pkg.pr.new/comark-badge@434

comark-bundle

pnpm add https://pkg.pr.new/comark-bundle@434

comark-cards

pnpm add https://pkg.pr.new/comark-cards@434

comark-carousel

pnpm add https://pkg.pr.new/comark-carousel@434

comark-cast

pnpm add https://pkg.pr.new/comark-cast@434

comark-charts

pnpm add https://pkg.pr.new/comark-charts@434

comark-chat

pnpm add https://pkg.pr.new/comark-chat@434

comark-chips

pnpm add https://pkg.pr.new/comark-chips@434

comark-cjk

pnpm add https://pkg.pr.new/comark-cjk@434

comark-code

pnpm add https://pkg.pr.new/comark-code@434

comark-code-notes

pnpm add https://pkg.pr.new/comark-code-notes@434

comark-colors

pnpm add https://pkg.pr.new/comark-colors@434

comark-comments

pnpm add https://pkg.pr.new/comark-comments@434

comark-critic

pnpm add https://pkg.pr.new/comark-critic@434

comark-deflist

pnpm add https://pkg.pr.new/comark-deflist@434

comark-details

pnpm add https://pkg.pr.new/comark-details@434

comark-diagrams

pnpm add https://pkg.pr.new/comark-diagrams@434

comark-diff

pnpm add https://pkg.pr.new/comark-diff@434

comark-embed

pnpm add https://pkg.pr.new/comark-embed@434

comark-fields

pnpm add https://pkg.pr.new/comark-fields@434

comark-figure

pnpm add https://pkg.pr.new/comark-figure@434

comark-file-tree

pnpm add https://pkg.pr.new/comark-file-tree@434

comark-footnotes

pnpm add https://pkg.pr.new/comark-footnotes@434

comark-git-graph

pnpm add https://pkg.pr.new/comark-git-graph@434

comark-github

pnpm add https://pkg.pr.new/comark-github@434

comark-icon

pnpm add https://pkg.pr.new/comark-icon@434

comark-include

pnpm add https://pkg.pr.new/comark-include@434

comark-keys

pnpm add https://pkg.pr.new/comark-keys@434

comark-links

pnpm add https://pkg.pr.new/comark-links@434

comark-linter

pnpm add https://pkg.pr.new/comark-linter@434

comark-magic-move

pnpm add https://pkg.pr.new/comark-magic-move@434

comark-mark

pnpm add https://pkg.pr.new/comark-mark@434

markdown-it-to-comark

pnpm add https://pkg.pr.new/markdown-it-to-comark@434

marked-to-comark

pnpm add https://pkg.pr.new/marked-to-comark@434

comark-mathml

pnpm add https://pkg.pr.new/comark-mathml@434

comark-media

pnpm add https://pkg.pr.new/comark-media@434

comark-metrics

pnpm add https://pkg.pr.new/comark-metrics@434

migrate-to-comark

pnpm add https://pkg.pr.new/migrate-to-comark@434

comark-outline

pnpm add https://pkg.pr.new/comark-outline@434

comark-properties

pnpm add https://pkg.pr.new/comark-properties@434

comark-qr

pnpm add https://pkg.pr.new/comark-qr@434

comark-quiz

pnpm add https://pkg.pr.new/comark-quiz@434

comark-reading-time

pnpm add https://pkg.pr.new/comark-reading-time@434

remark-to-comark

pnpm add https://pkg.pr.new/remark-to-comark@434

comark-sources

pnpm add https://pkg.pr.new/comark-sources@434

comark-steps

pnpm add https://pkg.pr.new/comark-steps@434

comark-table

pnpm add https://pkg.pr.new/comark-table@434

comark-tabs

pnpm add https://pkg.pr.new/comark-tabs@434

comark-tests

pnpm add https://pkg.pr.new/comark-tests@434

comark-time

pnpm add https://pkg.pr.new/comark-time@434

comark-ui

pnpm add https://pkg.pr.new/comark-ui@434

comark-xref

pnpm add https://pkg.pr.new/comark-xref@434

comark-zoom

pnpm add https://pkg.pr.new/comark-zoom@434

commit: b8875ce

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The lazy map introduces a client-side regression: restoring a saved tab can select one tab while displaying another tab's content.

Reviewed changes — Reviewed the new lazy Vue entry, its shared components, package exports, and regression tests.

  • Lazy renderer map: Adds comark-ui/vue/lazy with per-tag async wrappers and package-level dynamic imports.
  • Shared Vue blocks: Moves Mermaid and typeset components into a shared module without changing the eager entry's rendering.
  • Documentation and verification: Documents the entry and tests tag parity, SSR output, and deferred imports; also checked the published build's import graph and client-side first-use behavior.

Validation: pnpm build, workspace TypeScript checking, and all 18 existing UI test files passed (413 tests passed, one skipped). A targeted client regression probe failed only with the lazy map, and the same mismatch was confirmed in Chromium.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

Comment thread packages/ui/src/vue-lazy.ts Resolved
@vite-hub

vite-hub Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Completed 2026-11-15T02:26:35.779Z 6m 25s
View session Completed 2026-11-15T00:28:18.855Z 9m 11s

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

Session

Fixed the recursive AST typing defect in b8875ce using shallowRef and resolved the review thread. Workspace typechecking and 22 focused tests pass; lint passes with four unchanged warnings. One build test timed out during revalidation, then passed with a 20-second budget. Repair pushed; awaiting hosted checks and review.

Session

Fixed the recursive AST typing defect in b8875ce using shallowRef and resolved the review thread. Workspace typechecking and 22 focused tests pass; lint passes with four unchanged warnings. One build test timed out during revalidation, then passed with a 20-second budget. Repair pushed; awaiting hosted checks and review.

Session

Fixed the recursive AST typing defect in b8875ce using shallowRef and resolved the review thread. Workspace typechecking and 22 focused tests pass; lint passes with four unchanged warnings. One build test timed out during revalidation, then passed with a 20-second budget. Repair pushed; awaiting hosted checks and review.

View session

Fixed the recursive AST typing defect in b8875ce using shallowRef and resolved the review thread. Workspace typechecking and 22 focused tests pass; lint passes with four unchanged warnings. One build test timed out during revalidation, then passed with a 20-second budget. Repair pushed; awaiting hosted checks and review.

View session

Fixed the P1 lazy-tabs restoration bug in b8ab96f and resolved the review thread. Added a client navigation regression that failed before the fix and passes afterward. All 70 focused tests and repository lint passed, with four unrelated lint warnings. Repair pushed; awaiting hosted checks and review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The saved-tab behavior is fixed, but the new regression test introduces TypeScript errors that fail the required check job.

Reviewed changes — Reviewed b8ab96f, the follow-up commit since the previous Pullfrog review.

  • Restored saved tab selections when lazy panels mount after their parent runtime initializes.
  • Added client navigation coverage that checks both the selected header and visible panel after replacing a plain document with lazy tabs.

Validation: the workspace build and all 70 focused tests passed. Workspace typechecking failed with two errors in the new test; lint completed with four warnings in unchanged files.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

Comment thread packages/ui/test/vue-lazy.test.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found. No P0 or P1 findings remain.

Reviewed changes — Reviewed b8875ce, the test-typing correction since the previous review.

  • Replaced deep document reactivity with shallowRef in the lazy-navigation regression test, preserving recursive AST types while keeping document replacement reactive.

Validation: pnpm build, workspace TypeScript checking (tsrs --noEmit), and all 70 focused UI/tabs tests passed, including the first-use lazy-navigation regression.

Pullfrog  | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

@vite-hub
vite-hub Bot merged commit a6a8c90 into main Nov 15, 2026
7 checks passed
@vite-hub
vite-hub Bot deleted the perf/vue-lazy-components branch November 15, 2026 02:39
@github-actions github-actions Bot mentioned this pull request Nov 15, 2026
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