]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: remove refs from setupContext
authorEvan You <yyx990803@gmail.com>
Mon, 21 Oct 2019 14:36:38 +0000 (10:36 -0400)
committerEvan You <yyx990803@gmail.com>
Mon, 21 Oct 2019 14:36:38 +0000 (10:36 -0400)
explicit refs should be preferred

packages/runtime-core/src/component.ts

index 8dc9e758ea46e3aaa496410dafcd46bc0dfed94d..a6540f6785dbaea3e0f549f64a7ed067db87d608 100644 (file)
@@ -414,7 +414,7 @@ function finishComponentSetup(
 export const SetupProxySymbol = Symbol()
 
 const SetupProxyHandlers: { [key: string]: ProxyHandler<any> } = {}
-;['attrs', 'slots', 'refs'].forEach((type: string) => {
+;['attrs', 'slots'].forEach((type: string) => {
   SetupProxyHandlers[type] = {
     get: (instance, key) => instance[type][key],
     has: (instance, key) => key === SetupProxySymbol || key in instance[type],
@@ -429,12 +429,11 @@ const SetupProxyHandlers: { [key: string]: ProxyHandler<any> } = {}
 
 function createSetupContext(instance: ComponentInternalInstance): SetupContext {
   const context = {
-    // attrs, slots & refs are non-reactive, but they need to always expose
+    // attrs & slots are non-reactive, but they need to always expose
     // the latest values (instance.xxx may get replaced during updates) so we
     // need to expose them through a proxy
     attrs: new Proxy(instance, SetupProxyHandlers.attrs),
     slots: new Proxy(instance, SetupProxyHandlers.slots),
-    refs: new Proxy(instance, SetupProxyHandlers.refs),
     emit: instance.emit
   }
   return __DEV__ ? Object.freeze(context) : context