Repository navigation
fix(runtime-dom): apply css vars to a vapor slot rendered in vdom - #15575
Conversation
A vdom component whose root is `<slot/>` renders a `VaporSlot` vnode when the slot content comes from a vapor parent. `setVarsOnVNode` has no branch for it, so the component's own `v-bind()` css vars never reach that content - pure vdom applies them. Route the write through the interop, which resolves the slot's block from `vnode.vb` the same way the interop `move` already does.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
❌ Deploy Preview for vue-sfc-playground failed. Why did it fail? →
|
runtime-core trims its vapor exports for every format other than vapor and esm-bundler, so `VaporSlot` is not importable from runtime-dom and the global / cjs / esm-browser builds failed to resolve it. `vb` is only ever set on those vnodes, so the branch condition is equivalent.
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/compiler-vapor
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/runtime-vapor
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
Size ReportBundles
Usages
|
|
Thanks for the fix! The approach looks good to me. A couple of small suggestions: Could we preserve the existing component path and reuse setVarsOnBlock(vnode.vb || getVaporInstance(vnode).block, vars)This avoids another For the first test, could we toggle |
|
Both done, thanks — You were right about the test: replacing the whole object hid what it was meant to prove. It now toggles |
A vdom component whose root is
<slot/>and that declares css variables withv-bind()leaves slot content coming from a vapor parent unstyled. Under a vdom parent the same component styles it (playground — the box in the right column is green, the one in the left has no background).setVarsOnVNodehandles element, fragment, static and component vnodes, and aVaporSlotvnode falls through all of them. Its block sits onvnode.vb. I hand it to the vapor side through the interop interface, the same linemovealready uses there, sincesetVarsOnBlockis not reachable from runtime-dom.The variables are written when they are applied and re-applied by the existing MutationObserver, so a slot block that re-renders on its own is not re-registered. Same limitation as the vapor branch that is already there.