浏览代码

fix(runtime-core): avoid infinite warning loop for isRef check on component public proxy

fix #1091
Evan You 6 年之前
父节点
当前提交
62336085f4
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      packages/runtime-core/src/componentProxy.ts

+ 8 - 1
packages/runtime-core/src/componentProxy.ts

@@ -194,7 +194,14 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
       hasOwn(globalProperties, key))
     ) {
       return globalProperties[key]
-    } else if (__DEV__ && currentRenderingInstance) {
+    } else if (
+      __DEV__ &&
+      currentRenderingInstance &&
+      // #1091 avoid isRef/isVNode checks on component instance leading to
+      // infinite warning loop
+      key !== '_isRef' &&
+      key !== '_isVNode'
+    ) {
       if (data !== EMPTY_OBJ && key[0] === '$' && hasOwn(data, key)) {
         warn(
           `Property ${JSON.stringify(