Skip to content

fix(runtime-vapor): track reactive object style keys during hydration - #15663

Merged
edison1105 merged 4 commits into
vuejs:minorfrom
meta-syntax:fix/vapor-hydration-style-object-tracking
Sep 29, 2026
Merged

edison1105 merged 4 commits into
vuejs:minorfrom
meta-syntax:fix/vapor-hydration-style-object-tracking

Conversation

@meta-syntax

Copy link
Copy Markdown

Ports the fix of #11372 to Vapor.

In a production build, when a component hydrates <div :style="data.sty"> and data.sty is a reactive object, mutating a key (data.sty.color = 'green') does not update the DOM.

normalizeStyle returns an object style as is, and the keys are read by patchStyle. During hydration setStyle skips the patch, so no key is read inside the render effect and the keys are not tracked. In a dev build the mismatch check reads them, which hides the bug.

This PR reads the keys of a reactive style object at the top of setStyle during hydration, as runtime-core/src/hydration.ts does for VDOM. It is placed before the el.$root branch because both the template root (setStyleIncremental) and other elements skip the patch.

Reproduction

  1. SSR-render <div :style="data.sty"></div> with data.sty = reactive({ color: 'red' })
  2. Hydrate it with createVaporSSRApp in a production build (__DEV__ = false)
  3. Mutate a key: data.sty.color = 'green'
  4. After nextTick, the DOM is still <div style="color:red;"></div>

It updates as expected in a dev build, without hydration, when the whole object is replaced, and in the VDOM runtime.

The added test covers both the template root and a nested element, and fails without the fix.

Port the vuejs#11372 fix to Vapor. setStyle skips the patch during hydration,
so in production builds the keys of a reactive style object were never
read and mutating one did not update the DOM.
@coderabbitai

coderabbitai Bot commented Sep 27, 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: 24cb0b21-048d-4d85-9052-b51b35345ab5

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.

@pkg-pr-new

pkg-pr-new Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/compiler-ssr

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

@vue/compiler-vapor

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/runtime-vapor

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: ade475d

@github-actions

github-actions Bot commented Sep 29, 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 116 kB (+43 B) 43.9 kB (+14 B) 39.2 kB (-5 B)
vue.global.prod.js 176 kB (+43 B) 64 kB (+21 B) 57 kB (+13 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 53.1 kB (+43 B) 20.7 kB (+17 B) 18.9 kB (+16 B)
createApp 61.9 kB (+43 B) 23.9 kB (+15 B) 21.7 kB (+5 B)
createApp + vaporInteropPlugin 126 kB (+3.31 kB) 45.3 kB (+1.11 kB) 40.7 kB (+898 B)
createVaporApp 31.6 kB (+840 B) 12.2 kB (+346 B) 11.2 kB (+297 B)
createSSRApp 66.9 kB (+43 B) 25.9 kB (+15 B) 23.6 kB (+42 B)
createVaporSSRApp 38.4 kB (+1.26 kB) 14.6 kB (+489 B) 13.4 kB (+439 B)
defineCustomElement 68.4 kB (+43 B) 25.9 kB (+17 B) 23.5 kB (+20 B)
defineVaporCustomElement 47 kB (+840 B) 17.1 kB (+324 B) 15.7 kB (+309 B)
overall 77.4 kB (+43 B) 29.4 kB (+16 B) 26.7 kB (+24 B)

@edison1105
edison1105 merged commit 8301eda into vuejs:minor Sep 29, 2026
15 checks passed
meta-syntax added a commit to meta-syntax/website that referenced this pull request Sep 29, 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.

2 participants