Repository navigation
fix(runtime-dom): keep injected css vars when style binding becomes nullish - #15623
Conversation
|
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 |
@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
|
|
For context, this is the same bug as #9821 (fixed for string styles in #9824), just in the nullish branch. For example, a wrapper that themes a library component with |
When a
:stylebinding goes from an object tonullorundefined,patchStyleremoves the wholestyleattribute. That also wipes the variablesv-bind()in<style>put on the element, and nothing puts them back until the owner re-renders or the variables change.The easy way to hit it is
v-bind()in a parent and a nullable:styleon the root of a child that re-renders on its own (playground). In Vapor it also happens when both are in the same component.The string branch already keeps these variables (#9824). This does the same for the nullish case and writes the stored variable text back instead of removing the attribute. This changes VDOM too: there the variable used to disappear, and now it stays.