Repository navigation
fix(vapor): support ref in v-bind object - #15900
meta-syntax wants to merge 2 commits into
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 configuration
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
|
|
Thanks for the PR, but we're going to treat this as an intentional Vapor limitation rather than fix it. In Vapor, template refs are a compile-time construct: the compiler emits the ref binding only for an explicit Closing as won't fix |
Ports the fix of #10696 (#10706) to Vapor.
In Vapor, a
refinside av-bindobject is dropped, souseTemplateRef('r')staysnullfor both elements and components:In VDOM, these set the template ref, and inside
v-forthe ref becomes an array.Changes
patchDynamicPropspasses therefof the merged props to the template ref setter before skipping reserved keys. Like VDOM, the compiler adds{ ref_for: true }to the props of an element withv-bind="obj"insidev-for.v-bind="obj"and norefattribute, the compiler emitssetComponentPropsRef(n0, refFor)aftercreateComponent, at the same place assetStaticTemplateRef. It readsreffrom the inputs delivered to the component.Trade-offs
v-for,setDynamicPropsnow receives two sources for an element withv-bind="obj", so it merges them on each update. VDOM adds the same marker.v-bindobject gets one more render effect. With constant inputs, the ref is set once without an effect.Not covered
<component :is>with arefinsidev-bind: the dynamic component renders a fragment, and this PR leaves it unchanged.The added tests fail without the fix.