SSR hydration errors when combining inline styles with v-bind() in CSS #12439
Labels
🔨 p3-minor-bug
Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.
scope:hydration
Vue version
3.5.13
Link to minimal reproduction
Reproduction playground
Steps to reproduce
PageBlock.vue
Ensure SSR is enabled in the reproduction
In
PageBlock.vue
we initialize two props,color
andbackgroundColor
The
color
prop is bound to the element via inline:style
Use
v-bind
in thestyle
block to set thebackground-color
property, set to the value of thebackgroundColor
propNotice the hydration error in the console shown below.
Also notice that the generated CSS Custom Property for the
backgroundColor
value is not exposed in the hydration error (meaning I would expect to see--a4f2eed6-backgroundColor: lightgray;
in the hydration error as well)What is expected?
No hydration errors should be present when utilizing both inline style bindings and
v-bind
in CSS.The inline style properties should be resolved before render to prevent hydration errors to produce the final HTML, with both the inline
color
style as well as the generated CSS custom property binding:What is actually happening?
The inline style binding that is produced in the HTML appears to differ between server and client when the inline styles are merged with the
v-bind
in CSS rules.System Info
No response
Any additional comments?
The interesting piece is not only is the hydration error occurring, but comparing the output diff between server and client appears to show the actual rendered content is identical in this particular case.
In addition, the CSS custom property binding is not shown here in the client render, meaning I would expect to see
--a4f2eed6-backgroundColor: lightgray;
on the client line above.In more complex examples, the output appears to actually be different depending on how the inline styles are computed.
(This issue is similar to, but different, from #12434)
The text was updated successfully, but these errors were encountered: