Explorar el Código

chore: cache parent sibling

daiwei hace 10 meses
padre
commit
a0eb71796c
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      packages/runtime-vapor/src/dom/hydration.ts

+ 3 - 2
packages/runtime-vapor/src/dom/hydration.ts

@@ -26,9 +26,10 @@ function findParentSibling(n: Node): Node | null {
   return next ? next : findParentSibling(n.parentNode)
 }
 
-export function advanceHydrationNode(node: Node): void {
+export function advanceHydrationNode(node: Node & { $ps?: Node | null }): void {
   // if no next sibling, find the next node in the parent chain
-  const next = node.nextSibling || findParentSibling(node)
+  const next =
+    node.nextSibling || node.$ps || (node.$ps = findParentSibling(node))
   if (next) setCurrentHydrationNode(next)
 }