Explorar o código

fix: use fragment end anchor as vfor anchor

daiwei hai 10 meses
pai
achega
8ab7ecf77e
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      packages/runtime-vapor/src/apiCreateFor.ts

+ 4 - 4
packages/runtime-vapor/src/apiCreateFor.ts

@@ -98,10 +98,10 @@ export const createFor = (
   let currentKey: any
   let currentKey: any
   let parentAnchor: Node
   let parentAnchor: Node
   if (isHydrating) {
   if (isHydrating) {
-    parentAnchor = locateVaporFragmentAnchor(
-      currentHydrationNode!,
-      FOR_ANCHOR_LABEL,
-    )!
+    parentAnchor =
+      locateVaporFragmentAnchor(currentHydrationNode!, FOR_ANCHOR_LABEL) ||
+      // fallback to the fragment end anchor if in ssr slots vnode fallback
+      locateVaporFragmentAnchor(currentHydrationNode!, ']')!
     if (__DEV__ && !parentAnchor) {
     if (__DEV__ && !parentAnchor) {
       // this should not happen
       // this should not happen
       throw new Error(`v-for fragment anchor node was not found.`)
       throw new Error(`v-for fragment anchor node was not found.`)