Skip to content

Commit cd659fc

Browse files
authored
fix(ssr): should de-optimize on vnode with PatchFlags.BAIL (#4818)
fix #4679 fix #5771
1 parent 4101441 commit cd659fc

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/runtime-core/src/hydration.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,15 @@ export function createHydrationFunctions(
9797
isFragmentStart
9898
)
9999

100-
const { type, ref, shapeFlag } = vnode
100+
const { type, ref, shapeFlag, patchFlag } = vnode
101101
const domType = node.nodeType
102102
vnode.el = node
103103

104+
if (patchFlag === PatchFlags.BAIL) {
105+
optimized = false
106+
vnode.dynamicChildren = null
107+
}
108+
104109
let nextNode: Node | null = null
105110
switch (type) {
106111
case Text:

packages/runtime-dom/src/apiCustomElement.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ export function defineCustomElement(options: {
122122

123123
export function defineCustomElement(
124124
options: any,
125-
hydate?: RootHydrateFunction
125+
hydrate?: RootHydrateFunction
126126
): VueElementConstructor {
127127
const Comp = defineComponent(options as any)
128128
class VueCustomElement extends VueElement {
129129
static def = Comp
130130
constructor(initialProps?: Record<string, any>) {
131-
super(Comp, initialProps, hydate)
131+
super(Comp, initialProps, hydrate)
132132
}
133133
}
134134

0 commit comments

Comments
 (0)