From: Evan You Date: Fri, 11 Jun 2021 22:42:57 +0000 (-0400) Subject: refactor: use markRaw instead of internal flag check X-Git-Tag: v3.1.2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=056ef2a7d2057aa639812126f0b2c04bec4915c1;p=thirdparty%2Fvuejs%2Fcore.git refactor: use markRaw instead of internal flag check --- diff --git a/packages/runtime-core/src/component.ts b/packages/runtime-core/src/component.ts index 78cabdd353..d15fbbab1a 100644 --- a/packages/runtime-core/src/component.ts +++ b/packages/runtime-core/src/component.ts @@ -4,7 +4,8 @@ import { pauseTracking, resetTracking, shallowReadonly, - proxyRefs + proxyRefs, + markRaw } from '@vue/reactivity' import { ComponentPublicInstance, @@ -597,7 +598,7 @@ function setupStatefulComponent( instance.accessCache = Object.create(null) // 1. create public instance / render proxy // also mark it raw so it's never observed - instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers) + instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers)) if (__DEV__) { exposePropsOnRenderContext(instance) } diff --git a/packages/runtime-core/src/componentPublicInstance.ts b/packages/runtime-core/src/componentPublicInstance.ts index 493b7f131f..02b3bf2376 100644 --- a/packages/runtime-core/src/componentPublicInstance.ts +++ b/packages/runtime-core/src/componentPublicInstance.ts @@ -18,7 +18,6 @@ import { ReactiveEffect, toRaw, shallowReadonly, - ReactiveFlags, track, TrackOpTypes, ShallowUnwrapRef, @@ -268,11 +267,6 @@ export const PublicInstanceProxyHandlers: ProxyHandler = { appContext } = instance - // let @vue/reactivity know it should never observe Vue public instances. - if (key === ReactiveFlags.SKIP) { - return true - } - // for internal formatters to know that this is a Vue instance if (__DEV__ && key === '__isVue') { return true