From: Evan You Date: Fri, 1 May 2020 17:24:38 +0000 (-0400) Subject: perf: instance public proxy should never be observed X-Git-Tag: v3.0.0-beta.6~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11f38d8a853b2d8043212c17612b63df92322de4;p=thirdparty%2Fvuejs%2Fcore.git perf: instance public proxy should never be observed --- diff --git a/packages/runtime-core/src/component.ts b/packages/runtime-core/src/component.ts index dd1bf62ce0..1c9b17baee 100644 --- a/packages/runtime-core/src/component.ts +++ b/packages/runtime-core/src/component.ts @@ -4,7 +4,8 @@ import { ReactiveEffect, pauseTracking, resetTracking, - shallowReadonly + shallowReadonly, + markRaw } from '@vue/reactivity' import { ComponentPublicInstance, @@ -462,7 +463,8 @@ function setupStatefulComponent( // 0. create render proxy property access cache instance.accessCache = {} // 1. create public instance / render proxy - instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers) + // also mark it raw so it's never observed + instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers)) if (__DEV__) { exposePropsOnRenderContext(instance) }