Browse Source
fix: handle async placeholders in normalizeScopedSlot (#11963)
Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com>
dev
pooya parsa
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
2 deletions
-
src/core/vdom/helpers/normalize-scoped-slots.js
|
@ -3,6 +3,7 @@ |
|
|
import { def } from 'core/util/lang' |
|
|
import { def } from 'core/util/lang' |
|
|
import { normalizeChildren } from 'core/vdom/helpers/normalize-children' |
|
|
import { normalizeChildren } from 'core/vdom/helpers/normalize-children' |
|
|
import { emptyObject } from 'shared/util' |
|
|
import { emptyObject } from 'shared/util' |
|
|
|
|
|
import { isAsyncPlaceholder } from './is-async-placeholder' |
|
|
|
|
|
|
|
|
export function normalizeScopedSlots ( |
|
|
export function normalizeScopedSlots ( |
|
|
slots: { [key: string]: Function } | void, |
|
|
slots: { [key: string]: Function } | void, |
|
@ -60,9 +61,10 @@ function normalizeScopedSlot(normalSlots, key, fn) { |
|
|
res = res && typeof res === 'object' && !Array.isArray(res) |
|
|
res = res && typeof res === 'object' && !Array.isArray(res) |
|
|
? [res] // single vnode
|
|
|
? [res] // single vnode
|
|
|
: normalizeChildren(res) |
|
|
: normalizeChildren(res) |
|
|
|
|
|
let vnode: VNode = res && res[0] |
|
|
return res && ( |
|
|
return res && ( |
|
|
res.length === 0 || |
|
|
!vnode || |
|
|
(res.length === 1 && res[0].isComment) // #9658
|
|
|
(vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
|
|
|
) ? undefined |
|
|
) ? undefined |
|
|
: res |
|
|
: res |
|
|
} |
|
|
} |
|
|