Skip to content

fix(vue): accept a parsed document in a defined component - #408

Merged
farnabaz merged 2 commits into
perf/share-parserfrom
fix/vue-parsed-document
Sep 10, 2026
Merged

fix(vue): accept a parsed document in a defined component#408
farnabaz merged 2 commits into
perf/share-parserfrom
fix/vue-parsed-document

Conversation

@benjamincanac

Copy link
Copy Markdown
Collaborator

What

defineMarkdownComponent and defineMarkdownDocumentComponent now reuse the prop tables exported by <Markdown> and <MarkdownDocument> instead of hand-copying them. That fixes the reported Invalid prop: type check failed warning when passing an already parsed document, plus two forwarding gaps, and makes the drift structurally impossible.

Note

Based on #407 so the parser rebuild is a one-line computed rather than an expensive rebuild on every prop change. Review that one first.

Why

Reported from ui.nuxt.com: <Markdown> accepts value: [String, Object] and short-circuits on isMarkdownDocument, but the component defineMarkdownComponent returns declared value: { type: String }, so passing a parsed document warned even though it rendered correctly. The underlying cause is that the wrapper carried its own copy of the prop table, and the two had drifted three times. Fixing just value would leave the next drift to be found the same way.

Walkthrough

One prop table

markdownProps and markdownDocumentProps are exported from the components and the wrappers use them directly. The render calls spread props rather than listing each one.

A React-style spread alone would not have been enough here: in Vue, spreading props only spreads declared props, so data and documentKey would still have been missed. Sharing the declaration is what actually fixes it.

The three gaps this closes

  • value inherits [String, Object], so a parsed document no longer warns.
  • data is declared rather than relying on attribute fallthrough.
  • documentKey is declared on <Markdown> and forwarded to <MarkdownDocument>, which has been waiting for it. It is what the globalThis.comarkContext live-update subscription reads, and it previously needed two fallthrough hops through a component that sets class explicitly.

Worth noting for review: data did already arrive via fallthrough, so only the value warning and documentKey were visibly broken. I verified that by reverting the change and watching exactly those two tests fail. data is pinned anyway, since fallthrough is not something to depend on.

Exclude was a no-op

Exclude<ParserOptions, 'plugins'> appeared in six places. Exclude filters union members, so on an object type it resolves to plain ParserOptions. Omit is what was meant, and it surfaces a real bug: :options="{ plugins: [x] }" type-checked and was then silently discarded, because the component passes plugins: props.plugins separately.

This is a type-level breaking change for anyone who was relying on the accident, but it only rejects code that never worked at runtime.

`defineMarkdownComponent` hand-copied `<Markdown>`'s prop table, and the two had
drifted: `value` was declared `String` only, so passing an already parsed
document warned `Invalid prop: type check failed`, and `data` and `documentKey`
were missing entirely. `documentKey` never reached `<MarkdownDocument>` at all,
which is what its live-update subscription reads.

Both components now export their prop table and the wrappers reuse it, so the
two cannot drift again. `<Markdown>` declares and forwards `documentKey`.

Also replaces `Exclude<ParserOptions, 'plugins'>` with `Omit` in the six places
it appeared. `Exclude` filters union members, so on an object type it was a
no-op that resolved to plain `ParserOptions`, which let
`:options="{ plugins: [x] }"` type-check and then be silently discarded.
@coldtea-pr-lens

coldtea-pr-lens Bot commented Sep 10, 2026

Copy link
Copy Markdown

◈ PR Lens

🟢 +1 new · 🟠 ~8 changed · 🔴 -0 removed · 1 flow · 14 files · commit acef0b7


Architecture

Architecture diagram for comarkdown/comark at acef0b7

9 components touched across 3 lanes.

Open the interactive canvas


Inside the changed components — 1 view

Component view — Vue 3 adapter

Runtime prop sharing and prop forwarding across Vue factories and components

Architecture view of Component view — Vue 3 adapter in comarkdown/comark

Data flow

Data flow diagram for comarkdown/comark at acef0b7

Vue custom component prop forwarding and rendering

Open the interactive canvas


View

  • Architecture lens
  • Data flow lens
  • Expand every detail

Tip

Set github.comment.collapsed: true in .github/pr-lens.yml to fold the comment behind one View architecture and data flow row. Drawing still runs on every push.

🪧 More tips
  • Run npx skills add coldteadotai/pr-lens, then tell your coding agent: "Diagram the change you just made with PR Lens and attach it to the pull request."
  • Run npx @coldtea/pr-lens-cli analyze --base origin/main on a branch, then npx @coldtea/pr-lens-cli render .pr-lens/graph.json. Same lenses, your own model key, before the pull request exists.
  • Untick Architecture lens or Data flow lens under View to hide a diagram, or tick Expand every detail to open every section. The comment redraws in a few seconds.
  • Click the link under each diagram to open it on a canvas you can zoom, pan and step through.
  • The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change.
  • Open a diagram on the canvas, then press W or click play to walk through the change one step at a time.
  • The CLI's render reads .github/pr-lens.yml and applies your renames, exclusions and lane pins at draw time.
  • Add .github/workflows/pr-lens.yml with coldteadotai/pr-lens/packages/action@v0 and your model provider's key as its api-key to run PR Lens from your own CI. Any /chat/completions endpoint works.
  • Push a commit and the comment redraws for the new head. A slow older run never overwrites a newer one.
  • Switch GitHub to dark mode and the diagrams follow. The moving dots are this pull request's data in motion.

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

❤️ Share

@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
comark Ready Ready Preview Sep 10, 2026 11:00am UTC
comark-json-render Ready Ready Preview Sep 10, 2026 11:00am UTC
comark-nextjs Ready Ready Preview Sep 10, 2026 11:00am UTC
comark-nuxt Ready Ready Preview Sep 10, 2026 11:00am UTC
comark-svelte Ready Ready Preview Sep 10, 2026 11:00am UTC
comark-sveltekit Ready Ready Preview Sep 10, 2026 11:00am UTC
comark-twoslash Ready Ready Preview Sep 10, 2026 11:00am UTC
comark-vue Ready Ready Preview Sep 10, 2026 11:00am UTC

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 03dd1cac-3761-4e1a-b943-cc2b926cca82

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

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.

@farnabaz farnabaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM
Thanks

@farnabaz
farnabaz merged commit b48e98c into perf/share-parser Sep 10, 2026
13 checks passed
@farnabaz
farnabaz deleted the fix/vue-parsed-document branch September 10, 2026 12:11
@farnabaz
farnabaz restored the fix/vue-parsed-document branch September 10, 2026 12:32
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.

2 participants