]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor: use markRaw instead of internal flag check
authorEvan You <yyx990803@gmail.com>
Fri, 11 Jun 2021 22:42:57 +0000 (18:42 -0400)
committerEvan You <yyx990803@gmail.com>
Fri, 11 Jun 2021 22:46:31 +0000 (18:46 -0400)
packages/runtime-core/src/component.ts
packages/runtime-core/src/componentPublicInstance.ts

index 78cabdd3538b8b6d643a30a7640c2c1292d6877e..d15fbbab1a473d740feb137e4596f0a6881b6e03 100644 (file)
@@ -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)
   }
index 493b7f131f901f600daa1a3c096aa8a096925929..02b3bf237673b4988f9ccc39cc2b3cf0043ac80b 100644 (file)
@@ -18,7 +18,6 @@ import {
   ReactiveEffect,
   toRaw,
   shallowReadonly,
-  ReactiveFlags,
   track,
   TrackOpTypes,
   ShallowUnwrapRef,
@@ -268,11 +267,6 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
       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