From 26c859aeddb6b85f027cc52cadc3b68805d48f2d Mon Sep 17 00:00:00 2001 From: Evan You Date: Sat, 2 Nov 2019 10:38:25 -0400 Subject: [PATCH] chore: simplify check --- packages/runtime-core/src/suspense.ts | 6 +----- packages/runtime-core/src/vnode.ts | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/runtime-core/src/suspense.ts b/packages/runtime-core/src/suspense.ts index a01d7b20..1494d241 100644 --- a/packages/runtime-core/src/suspense.ts +++ b/packages/runtime-core/src/suspense.ts @@ -1,4 +1,4 @@ -import { VNode, normalizeVNode, VNodeChild, VNodeTypes } from './vnode' +import { VNode, normalizeVNode, VNodeChild } from './vnode' import { ShapeFlags } from './shapeFlags' import { isFunction, isArray } from '@vue/shared' import { ComponentInternalInstance, handleSetupResult } from './component' @@ -9,10 +9,6 @@ import { updateHOCHostEl } from './componentRenderUtils' import { handleError, ErrorCodes } from './errorHandling' import { pushWarningContext, popWarningContext } from './warning' -export function isSuspenseType(type: VNodeTypes): type is typeof SuspenseImpl { - return (type as any).__isSuspense === true -} - export const SuspenseImpl = { __isSuspense: true, process( diff --git a/packages/runtime-core/src/vnode.ts b/packages/runtime-core/src/vnode.ts index 1159e989..1f6d9040 100644 --- a/packages/runtime-core/src/vnode.ts +++ b/packages/runtime-core/src/vnode.ts @@ -16,7 +16,7 @@ import { RawSlots } from './componentSlots' import { ShapeFlags } from './shapeFlags' import { isReactive, Ref } from '@vue/reactivity' import { AppContext } from './apiApp' -import { SuspenseBoundary, isSuspenseType } from './suspense' +import { SuspenseBoundary } from './suspense' import { DirectiveBinding } from './directives' import { SuspenseImpl } from './suspense' @@ -209,7 +209,7 @@ export function createVNode( // encode the vnode type information into a bitmap const shapeFlag = isString(type) ? ShapeFlags.ELEMENT - : __FEATURE_SUSPENSE__ && isSuspenseType(type) + : __FEATURE_SUSPENSE__ && (type as any).__isSuspense === true ? ShapeFlags.SUSPENSE : isObject(type) ? ShapeFlags.STATEFUL_COMPONENT