Repository navigation
fix(vapor): hydrate custom element children - #15595
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
|
|
VDOM does not support this literal HTML This is an edge case with no demonstrated real-world use case. Let's keep this fix focused on custom elements and remove the generic |
|
Done in c83d215. I removed the Two custom element tests remain: one with a single child, one with multiple children plus a following sibling. The second keeps the append-index path covered now that the multi-child template test is gone. Both fail on the base commit. |
edison1105
left a comment
There was a problem hiding this comment.
The previous scope concern is addressed. There is still an initially empty text case missing from the custom-element hydration fix.
SSR omits an empty text node, so locating it inside a custom element's insertion state found nothing and threw. Seed the missing text at its append position instead, the same way other hydration entry points already handle blank text.
bce6cac to
2f88626
Compare
A custom element or a plain
<template>goes throughcreatePlainElement. The compiler emits its children as templates of their own and inserts them after the element exists. During hydration those child templates read whatever cursor the enclosing scope left behind instead of the element's own server output, so they adopt the wrong node and throw. Block children (v-if,v-for, components) survive because codegen already gives themsetInsertionState.Template children now carry insertion state too, and
template()enters and exits a hydration cursor when it finds one, so it adopts inside the element and hands the enclosing resume point back afterwards. A server-rendered<template>keeps its children in itscontentfragment, so the lookup checks there as well.close #15593