From e8c0248461660c62dc3fa789199800e3e95bbe4b Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Tue, 16 Mar 2021 14:05:34 +0100 Subject: [PATCH 1/3] fix: handle async placeholders in normalizeScopedSlot --- src/core/vdom/helpers/normalize-scoped-slots.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/vdom/helpers/normalize-scoped-slots.js b/src/core/vdom/helpers/normalize-scoped-slots.js index 1e43fd393f..15ab396d20 100644 --- a/src/core/vdom/helpers/normalize-scoped-slots.js +++ b/src/core/vdom/helpers/normalize-scoped-slots.js @@ -3,6 +3,7 @@ import { def } from 'core/util/lang' import { normalizeChildren } from 'core/vdom/helpers/normalize-children' import { emptyObject } from 'shared/util' +import { isAsyncPlaceholder } from './is-async-placeholder' export function normalizeScopedSlots ( slots: { [key: string]: Function } | void, @@ -60,9 +61,10 @@ function normalizeScopedSlot(normalSlots, key, fn) { res = res && typeof res === 'object' && !Array.isArray(res) ? [res] // single vnode : normalizeChildren(res) + let vnode: VNode = res && res[0] return res && ( - res.length === 0 || - (res.length === 1 && res[0].isComment) // #9658 + !vnode || + (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391 ) ? undefined : res } From d0cf0752ce76fc75ae835d365b42c0872135a39b Mon Sep 17 00:00:00 2001 From: pooya parsa Date: Wed, 24 Mar 2021 11:41:28 +0100 Subject: [PATCH 2/3] ensure res.length is 1 Co-authored-by: Eduardo San Martin Morote --- src/core/vdom/helpers/normalize-scoped-slots.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/vdom/helpers/normalize-scoped-slots.js b/src/core/vdom/helpers/normalize-scoped-slots.js index 15ab396d20..c89bac069e 100644 --- a/src/core/vdom/helpers/normalize-scoped-slots.js +++ b/src/core/vdom/helpers/normalize-scoped-slots.js @@ -61,7 +61,7 @@ function normalizeScopedSlot(normalSlots, key, fn) { res = res && typeof res === 'object' && !Array.isArray(res) ? [res] // single vnode : normalizeChildren(res) - let vnode: VNode = res && res[0] + let vnode: VNode = res && res.length === 1 && res[0] return res && ( !vnode || (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391 From 3451090cd7af50a79029c9d281cfff1bc5788e31 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Wed, 24 Mar 2021 12:41:08 +0100 Subject: [PATCH 3/3] Update src/core/vdom/helpers/normalize-scoped-slots.js --- src/core/vdom/helpers/normalize-scoped-slots.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/vdom/helpers/normalize-scoped-slots.js b/src/core/vdom/helpers/normalize-scoped-slots.js index c89bac069e..15ab396d20 100644 --- a/src/core/vdom/helpers/normalize-scoped-slots.js +++ b/src/core/vdom/helpers/normalize-scoped-slots.js @@ -61,7 +61,7 @@ function normalizeScopedSlot(normalSlots, key, fn) { res = res && typeof res === 'object' && !Array.isArray(res) ? [res] // single vnode : normalizeChildren(res) - let vnode: VNode = res && res.length === 1 && res[0] + let vnode: VNode = res && res[0] return res && ( !vnode || (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391