From: edison Date: Tue, 10 May 2022 10:35:34 +0000 (+0800) Subject: fix(ssr): should de-optimize on vnode with PatchFlags.BAIL (#4818) X-Git-Tag: v3.2.34-beta.1~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd659fc86f74741987bacc351f0d94ef3b80a1ca;p=thirdparty%2Fvuejs%2Fcore.git fix(ssr): should de-optimize on vnode with PatchFlags.BAIL (#4818) fix #4679 fix #5771 --- diff --git a/packages/runtime-core/src/hydration.ts b/packages/runtime-core/src/hydration.ts index ef66f0d3fe..3d86f0f249 100644 --- a/packages/runtime-core/src/hydration.ts +++ b/packages/runtime-core/src/hydration.ts @@ -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: diff --git a/packages/runtime-dom/src/apiCustomElement.ts b/packages/runtime-dom/src/apiCustomElement.ts index 059fcac16f..eabe83b6b9 100644 --- a/packages/runtime-dom/src/apiCustomElement.ts +++ b/packages/runtime-dom/src/apiCustomElement.ts @@ -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) { - super(Comp, initialProps, hydate) + super(Comp, initialProps, hydrate) } }