Skip to content

Commit

Permalink
fix(ssr): should de-optimize on vnode with PatchFlags.BAIL (vuejs#4818)
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 authored and iwusong committed May 13, 2022
1 parent b028bac commit ec3d65b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion packages/runtime-core/src/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions packages/runtime-dom/src/apiCustomElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit ec3d65b

Please sign in to comment.