]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
perf: instance public proxy should never be observed
authorEvan You <yyx990803@gmail.com>
Fri, 1 May 2020 17:24:38 +0000 (13:24 -0400)
committerEvan You <yyx990803@gmail.com>
Fri, 1 May 2020 17:24:38 +0000 (13:24 -0400)
packages/runtime-core/src/component.ts

index dd1bf62ce040b88553cbac38e3fc1b2cf756e222..1c9b17baeec47b62909011f69765fe7668f3dd2a 100644 (file)
@@ -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)
   }