]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(ssr): should de-optimize on vnode with PatchFlags.BAIL (#4818)
authoredison <daiwei521@126.com>
Tue, 10 May 2022 10:35:34 +0000 (18:35 +0800)
committerGitHub <noreply@github.com>
Tue, 10 May 2022 10:35:34 +0000 (06:35 -0400)
fix #4679
fix #5771

packages/runtime-core/src/hydration.ts
packages/runtime-dom/src/apiCustomElement.ts

index ef66f0d3fe6021da227222a6254e84426eaffec6..3d86f0f2494b66be5664fbbe19fff484de5e544b 100644 (file)
@@ -97,10 +97,15 @@ export function createHydrationFunctions(
         isFragmentStart
       )
 
-    const { type, ref, shapeFlag } = vnode
+    const { type, ref, shapeFlag, patchFlag } = vnode
     const domType = node.nodeType
     vnode.el = node
 
+    if (patchFlag === PatchFlags.BAIL) {
+      optimized = false
+      vnode.dynamicChildren = null
+    }
+
     let nextNode: Node | null = null
     switch (type) {
       case Text:
index 059fcac16f1a04495327c3fa43b62956d2565f93..eabe83b6b9fff578c6c49a2c632f3e372d3327a2 100644 (file)
@@ -122,13 +122,13 @@ export function defineCustomElement(options: {
 
 export function defineCustomElement(
   options: any,
-  hydate?: RootHydrateFunction
+  hydrate?: RootHydrateFunction
 ): VueElementConstructor {
   const Comp = defineComponent(options as any)
   class VueCustomElement extends VueElement {
     static def = Comp
     constructor(initialProps?: Record<string, any>) {
-      super(Comp, initialProps, hydate)
+      super(Comp, initialProps, hydrate)
     }
   }