From 162ab918e8f86ead49eb45856764a0e6c11ebd83 Mon Sep 17 00:00:00 2001 From: liximomo Date: Thu, 26 Aug 2021 17:20:30 +0800 Subject: [PATCH 1/2] fix: misuse Dom's Comment element constructor as a vnode type --- packages/runtime-core/src/components/Suspense.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/runtime-core/src/components/Suspense.ts b/packages/runtime-core/src/components/Suspense.ts index 6a27b7c2d26..f70be1a51c2 100644 --- a/packages/runtime-core/src/components/Suspense.ts +++ b/packages/runtime-core/src/components/Suspense.ts @@ -6,6 +6,7 @@ import { openBlock, closeBlock, currentBlock, + Comment, createVNode } from '../vnode' import { isFunction, isArray, ShapeFlags, toNumber } from '@vue/shared' @@ -87,7 +88,9 @@ export const SuspenseImpl = { } // Force-casted public typing for h and TSX props inference -export const Suspense = (__FEATURE_SUSPENSE__ ? SuspenseImpl : null) as any as { +export const Suspense = ((__FEATURE_SUSPENSE__ + ? SuspenseImpl + : null) as any) as { __isSuspense: true new (): { $props: VNodeProps & SuspenseProps } } @@ -518,8 +521,13 @@ function createSuspenseBoundary( return } - const { vnode, activeBranch, parentComponent, container, isSVG } = - suspense + const { + vnode, + activeBranch, + parentComponent, + container, + isSVG + } = suspense // invoke @fallback event triggerEvent(vnode, 'onFallback') From 4db0d26bf1280b17c21303780bc0c87508d882ae Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 1 Sep 2021 16:53:00 -0400 Subject: [PATCH 2/2] Update Suspense.ts --- packages/runtime-core/src/components/Suspense.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/runtime-core/src/components/Suspense.ts b/packages/runtime-core/src/components/Suspense.ts index f70be1a51c2..bb5ef9b3ce6 100644 --- a/packages/runtime-core/src/components/Suspense.ts +++ b/packages/runtime-core/src/components/Suspense.ts @@ -88,9 +88,7 @@ export const SuspenseImpl = { } // Force-casted public typing for h and TSX props inference -export const Suspense = ((__FEATURE_SUSPENSE__ - ? SuspenseImpl - : null) as any) as { +export const Suspense = (__FEATURE_SUSPENSE__ ? SuspenseImpl : null) as any as { __isSuspense: true new (): { $props: VNodeProps & SuspenseProps } } @@ -521,13 +519,8 @@ function createSuspenseBoundary( return } - const { - vnode, - activeBranch, - parentComponent, - container, - isSVG - } = suspense + const { vnode, activeBranch, parentComponent, container, isSVG } = + suspense // invoke @fallback event triggerEvent(vnode, 'onFallback')