Skip to content

fix(compiler-vapor): set the value of an input after its other props - #15722

Merged
edison1105 merged 2 commits into
vuejs:minorfrom
ValentinYoushkevich:fix/vapor-value-after-other-props
Oct 8, 2026
Merged

edison1105 merged 2 commits into
vuejs:minorfrom
ValentinYoushkevich:fix/vapor-value-after-other-props

Conversation

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor

On <input type="range" :value="v" :max="m"> vapor sets value in source order, before max. A range input clamps its value to the current max, which is 100 by default, so a value above that is cut and stays cut. vdom applies value after the other props for this reason (#2325, #4024). Real case: FocusTide inputNumber.vue and lazy-brush Slider.vue, both binding :value, :min and :max. Playground

The compiler now emits value last, and patchDynamicProps does the same for v-bind objects.

@coderabbitai

coderabbitai Bot commented Sep 30, 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: f143cf9c-697f-41ab-b501-fb5fd50dea77

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 Sep 30, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@15722
npm i https://pkg.pr.new/@vue/compiler-core@15722
yarn add https://pkg.pr.new/@vue/compiler-core@15722.tgz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@15722
npm i https://pkg.pr.new/@vue/compiler-dom@15722
yarn add https://pkg.pr.new/@vue/compiler-dom@15722.tgz

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@15722
npm i https://pkg.pr.new/@vue/compiler-sfc@15722
yarn add https://pkg.pr.new/@vue/compiler-sfc@15722.tgz

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@15722
npm i https://pkg.pr.new/@vue/compiler-ssr@15722
yarn add https://pkg.pr.new/@vue/compiler-ssr@15722.tgz

@vue/compiler-vapor

pnpm add https://pkg.pr.new/@vue/compiler-vapor@15722
npm i https://pkg.pr.new/@vue/compiler-vapor@15722
yarn add https://pkg.pr.new/@vue/compiler-vapor@15722.tgz

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@15722
npm i https://pkg.pr.new/@vue/reactivity@15722
yarn add https://pkg.pr.new/@vue/reactivity@15722.tgz

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@15722
npm i https://pkg.pr.new/@vue/runtime-core@15722
yarn add https://pkg.pr.new/@vue/runtime-core@15722.tgz

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@15722
npm i https://pkg.pr.new/@vue/runtime-dom@15722
yarn add https://pkg.pr.new/@vue/runtime-dom@15722.tgz

@vue/runtime-vapor

pnpm add https://pkg.pr.new/@vue/runtime-vapor@15722
npm i https://pkg.pr.new/@vue/runtime-vapor@15722
yarn add https://pkg.pr.new/@vue/runtime-vapor@15722.tgz

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@15722
npm i https://pkg.pr.new/@vue/server-renderer@15722
yarn add https://pkg.pr.new/@vue/server-renderer@15722.tgz

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@15722
npm i https://pkg.pr.new/@vue/shared@15722
yarn add https://pkg.pr.new/@vue/shared@15722.tgz

vue

pnpm add https://pkg.pr.new/vue@15722
npm i https://pkg.pr.new/vue@15722
yarn add https://pkg.pr.new/vue@15722.tgz

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@15722
npm i https://pkg.pr.new/@vue/compat@15722
yarn add https://pkg.pr.new/@vue/compat@15722.tgz

commit: b2a4c25

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 87.2 kB (+1 B) 30.6 kB (+1 B) 26.9 kB (-42 B)
runtime-dom.global.prod.js 117 kB (+125 B) 43.9 kB (+54 B) 39.3 kB (+54 B)
vue.global.prod.js 177 kB (+125 B) 64 kB (+63 B) 57 kB (+46 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 53.2 kB (+106 B) 20.7 kB (+45 B) 18.9 kB (+20 B)
createApp 62 kB (+106 B) 23.9 kB (+42 B) 21.8 kB (+27 B)
createApp + vaporInteropPlugin 129 kB (+6.73 kB) 46.6 kB (+2.38 kB) 41.8 kB (+2 kB)
createVaporApp 34.1 kB (+3.36 kB) 13.1 kB (+1.28 kB) 12 kB (+1.17 kB)
createSSRApp 67 kB (+106 B) 26 kB (+48 B) 23.6 kB (+31 B)
createVaporSSRApp 40.9 kB (+3.8 kB) 15.5 kB (+1.45 kB) 14.3 kB (+1.33 kB)
defineCustomElement 68.5 kB (+106 B) 25.9 kB (+47 B) 23.6 kB (+57 B)
defineVaporCustomElement 48.7 kB (+2.5 kB) 17.8 kB (+941 B) 16.4 kB (+951 B)
overall 77.5 kB (+106 B) 29.5 kB (+46 B) 26.7 kB (+98 B)

@edison1105

Copy link
Copy Markdown
Member

The direction looks right, but there are still three gaps worth covering:

  1. hasEffect is overwritten by each registerEffect() result. An intervening constant setter can reset it to false, causing a constant value to be emitted before the preceding dynamic props. For example, <input type="range" :max="max" :step="step" :value="500"> with a reactive max and const step = 1. This should track whether any preceding prop registered an effect; operation.effect should still use the current registration's result.

  2. patchDynamicProps() still skips an unchanged primitive value. With v-bind="{ value: 500, max }", changing max from 1000 → 100 → 1000 leaves the DOM value at 100. VDOM's full props patch reapplies value at the end even when the binding is unchanged. Deferring it outside the loop would also avoid the added indexOf/splice.

  3. value="500" and :value="'500'" still fold into the template. With a dynamic max, the browser clamps the initial value before the max effect runs, so moving the prop to the end does not fix these cases.

Could we add regression tests for these paths, including the max round trip rather than only initial mounting?

@edison1105 edison1105 added the scope: vapor related to vapor mode label Sep 30, 2026
…path

Track whether any preceding prop registered an effect instead of only the
last one, reapply value after the other props in patchDynamicProps even
when unchanged like vdom's full props patch, and stop folding a static
input value into the template when type, min, max or step is set at
runtime.
@ValentinYoushkevich
ValentinYoushkevich force-pushed the fix/vapor-value-after-other-props branch from 360606a to b2a4c25 Compare October 1, 2026 04:26
@ValentinYoushkevich

Copy link
Copy Markdown
Contributor Author

Good catches, all three reproduced. Fixed in b2a4c25:

  1. hasEffect now records whether any preceding prop registered an effect (hasEffect = effect || hasEffect). operation.effect still takes the current registration's result. Covered by <input type="range" :max="data" :step="step" :value="500"> with const step = 1, as a render test and a codegen test.
  2. patchDynamicProps() skips value inside the loop and sets it after the loop whenever it's present, even if unchanged, the same way vdom's full props patch does. The indexOf/splice is gone. The test does the v-bind round trip with max 1000 → 100 → 1000 and checks the DOM value after each step. jsdom doesn't re-clamp when max changes, so the test wraps the max setter to clamp the way browsers do.
  3. A static value on an <input> no longer goes into the template when type/min/max/step is set at runtime before it. It becomes a setter after them. Covered by value="500" and :value="'500'" with a dynamic max, by codegen tests that check other cases still fold (<input :title value>, a static max, a non-input), and by a hydration test. Because the value is now a setter, a hydration mismatch on it gets reported, like vdom already does.

@edison1105
edison1105 merged commit 80159a0 into vuejs:minor Oct 8, 2026
15 checks passed
zhiyuanzmj added a commit to vuejs/vue-jsx-vapor that referenced this pull request Oct 13, 2026
zhiyuanzmj added a commit to re-thc/vue-jsx-vapor that referenced this pull request Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: vapor related to vapor mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants