fix(suspense): fix suspense slot inside deoptimized slot call

fix #4556
This commit is contained in:
Evan You 2021-09-16 12:14:33 -04:00
parent 93949ed20a
commit 141a5e188c

View File

@ -7,7 +7,8 @@ import {
closeBlock, closeBlock,
currentBlock, currentBlock,
Comment, Comment,
createVNode createVNode,
isBlockTreeEnabled
} from '../vnode' } from '../vnode'
import { isFunction, isArray, ShapeFlags, toNumber } from '@vue/shared' import { isFunction, isArray, ShapeFlags, toNumber } from '@vue/shared'
import { ComponentInternalInstance, handleSetupResult } from '../component' import { ComponentInternalInstance, handleSetupResult } from '../component'
@ -727,8 +728,8 @@ function normalizeSuspenseChildren(vnode: VNode) {
function normalizeSuspenseSlot(s: any) { function normalizeSuspenseSlot(s: any) {
let block: VNode[] | null | undefined let block: VNode[] | null | undefined
if (isFunction(s)) { if (isFunction(s)) {
const isCompiledSlot = s._c const trackBlock = isBlockTreeEnabled && s._c
if (isCompiledSlot) { if (trackBlock) {
// disableTracking: false // disableTracking: false
// allow block tracking for compiled slots // allow block tracking for compiled slots
// (see ./componentRenderContext.ts) // (see ./componentRenderContext.ts)
@ -736,7 +737,7 @@ function normalizeSuspenseSlot(s: any) {
openBlock() openBlock()
} }
s = s() s = s()
if (isCompiledSlot) { if (trackBlock) {
s._d = true s._d = true
block = currentBlock block = currentBlock
closeBlock() closeBlock()