fix(runtime-core): properly check forwarded slots type (#3781)

fix #3779
This commit is contained in:
HcySunYang
2021-05-26 23:52:03 +08:00
committed by GitHub
parent 4e3f82f683
commit e8ddf86080
2 changed files with 53 additions and 3 deletions

View File

@@ -651,12 +651,12 @@ export function normalizeChildren(vnode: VNode, children: unknown) {
// a child component receives forwarded slots from the parent.
// its slot type is determined by its parent's slot type.
if (
currentRenderingInstance.vnode.patchFlag & PatchFlags.DYNAMIC_SLOTS
(currentRenderingInstance.slots as RawSlots)._ === SlotFlags.STABLE
) {
;(children as RawSlots)._ = SlotFlags.STABLE
} else {
;(children as RawSlots)._ = SlotFlags.DYNAMIC
vnode.patchFlag |= PatchFlags.DYNAMIC_SLOTS
} else {
;(children as RawSlots)._ = SlotFlags.STABLE
}
}
}