Skip to content

fix(compiler-vapor): pass a static style to components as an object like vdom - #15745

Merged
edison1105 merged 1 commit into
vuejs:minorfrom
ValentinYoushkevich:fix/vapor-static-style-component-prop
Oct 2, 2026
Merged

edison1105 merged 1 commit into
vuejs:minorfrom
ValentinYoushkevich:fix/vapor-static-style-component-prop

Conversation

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor

In a Vapor template, a static style on a component reaches the child as a string, while VDOM compiles it to an object. Code that expects the object breaks: { ...attrs.style } spreads characters and patchStyle throws, and a typeof style === 'object' check silently drops the style (playground). Hydration mismatches too, since SSR renders the object.

antdv-next's Menu spreads ...attrs.style and its docs use <a-menu style="width: 256px">, so that demo crashes under a Vapor parent. Their Vapor port does the same in TextArea.

This parses a static style on components with parseStringStyle, as VDOM's transformStyle does. Slot outlets and elements keep the string, as in VDOM.

@coderabbitai

coderabbitai Bot commented Oct 2, 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: e98dca17-f828-4040-b49d-dc22b22d8234

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
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@pkg-pr-new

pkg-pr-new Bot commented Oct 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@15745
npm i https://pkg.pr.new/@vue/compiler-core@15745
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@15745
npm i https://pkg.pr.new/@vue/compiler-dom@15745
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@15745
npm i https://pkg.pr.new/@vue/compiler-sfc@15745
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@15745
npm i https://pkg.pr.new/@vue/compiler-ssr@15745
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-vapor

pnpm add https://pkg.pr.new/@vue/compiler-vapor@15745
npm i https://pkg.pr.new/@vue/compiler-vapor@15745
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@15745
npm i https://pkg.pr.new/@vue/reactivity@15745
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@15745
npm i https://pkg.pr.new/@vue/runtime-core@15745
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@15745
npm i https://pkg.pr.new/@vue/runtime-dom@15745
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-vapor

pnpm add https://pkg.pr.new/@vue/runtime-vapor@15745
npm i https://pkg.pr.new/@vue/runtime-vapor@15745
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@15745
npm i https://pkg.pr.new/@vue/server-renderer@15745
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@15745
npm i https://pkg.pr.new/@vue/shared@15745
yarn add https://pkg.pr.new/@vue/[email protected]

vue

pnpm add https://pkg.pr.new/vue@15745
npm i https://pkg.pr.new/vue@15745
yarn add https://pkg.pr.new/[email protected]

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@15745
npm i https://pkg.pr.new/@vue/compat@15745
yarn add https://pkg.pr.new/@vue/[email protected]

commit: 501610d

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 87.2 kB 30.6 kB 26.9 kB
runtime-dom.global.prod.js 117 kB 43.9 kB 39.3 kB
vue.global.prod.js 177 kB 64 kB 57 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 53.2 kB 20.7 kB 18.9 kB
createApp 62 kB 23.9 kB 21.8 kB
createApp + vaporInteropPlugin 129 kB 46.5 kB 41.8 kB
createVaporApp 34.1 kB 13.1 kB 12 kB
createSSRApp 67 kB 26 kB 23.6 kB
createVaporSSRApp 40.8 kB 15.5 kB 14.2 kB
defineCustomElement 68.5 kB 25.9 kB 23.6 kB
defineVaporCustomElement 48.6 kB 17.7 kB 16.3 kB
overall 77.5 kB 29.5 kB 26.7 kB

@edison1105
edison1105 merged commit 435ee84 into vuejs:minor Oct 2, 2026
15 checks passed
zhiyuanzmj added a commit to vuejs/vue-jsx-vapor that referenced this pull request Oct 13, 2026
…ike vdom

A static `style` written on a component reached it as the raw CSS string, so
`$attrs.style` was a string while the vdom compiler passes an object
(`transformStyle` -> `parseStringStyle` -> `JSON.stringify`). A child merging
it (`{ ...$attrs.style, color: 'red' }`) then got character indices instead of
style properties.

Emit `_normalizeStyle(["<css>"])` instead of parsing the CSS in the compiler:
`normalizeStyle` parses the strings of a style array, so vue's own parser
produces the object at runtime and the compiler needs no copy of it. The
runtime memoizes prop getters in a computed, so the parse happens once per
component instance and only when `style` is read.

Plain elements keep the string (it is baked into the template) and so do
custom elements, which compile to `createPlainElement` -- matching the
upstream gate on `ElementTypes.COMPONENT`.

Merged from vuejs/core#15745
zhiyuanzmj added a commit to re-thc/vue-jsx-vapor that referenced this pull request Oct 18, 2026
…ike vdom

A static `style` written on a component reached it as the raw CSS string, so
`$attrs.style` was a string while the vdom compiler passes an object
(`transformStyle` -> `parseStringStyle` -> `JSON.stringify`). A child merging
it (`{ ...$attrs.style, color: 'red' }`) then got character indices instead of
style properties.

Emit `_normalizeStyle(["<css>"])` instead of parsing the CSS in the compiler:
`normalizeStyle` parses the strings of a style array, so vue's own parser
produces the object at runtime and the compiler needs no copy of it. The
runtime memoizes prop getters in a computed, so the parse happens once per
component instance and only when `style` is read.

Plain elements keep the string (it is baked into the template) and so do
custom elements, which compile to `createPlainElement` -- matching the
upstream gate on `ElementTypes.COMPONENT`.

Merged from vuejs/core#15745
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