]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: remove warnings due to potential false-positives
authorEvan You <yyx990803@gmail.com>
Tue, 21 Feb 2023 14:43:45 +0000 (22:43 +0800)
committerEvan You <yyx990803@gmail.com>
Tue, 21 Feb 2023 14:43:45 +0000 (22:43 +0800)
packages/runtime-core/src/component.ts

index c75c185035e7a32bc913d817c3c37e96c5ae8af2..3e184d352cfcc120bd62128f6824a71c98d9a2f0 100644 (file)
@@ -570,9 +570,9 @@ type GlobalInstanceSetter = ((
   instance: ComponentInternalInstance | null
 ) => void) & { version?: string }
 
-let globalCurrentInstanceSetters: GlobalInstanceSetter[]
 let internalSetCurrentInstance: GlobalInstanceSetter
-let hasWarnedDuplicatedVue = false
+let globalCurrentInstanceSetters: GlobalInstanceSetter[]
+let settersKey = '__VUE_INSTANCE_SETTERS__'
 
 /**
  * The following makes getCurrentInstance() usage across multiple copies of Vue
@@ -587,33 +587,12 @@ let hasWarnedDuplicatedVue = false
  * found during browser execution.
  */
 if (__SSR__) {
-  const settersKey = '__VUE_INSTANCE_SETTERS__'
   if (!(globalCurrentInstanceSetters = getGlobalThis()[settersKey])) {
     globalCurrentInstanceSetters = getGlobalThis()[settersKey] = []
   }
   globalCurrentInstanceSetters.push(i => (currentInstance = i))
-
-  if (__DEV__) {
-    globalCurrentInstanceSetters[
-      globalCurrentInstanceSetters.length - 1
-    ].version = __VERSION__
-  }
-
   internalSetCurrentInstance = instance => {
     if (globalCurrentInstanceSetters.length > 1) {
-      // eslint-disable-next-line no-restricted-globals
-      if (__DEV__ && !hasWarnedDuplicatedVue && typeof window !== 'undefined') {
-        warn(
-          `Mixed usage of duplicated Vue runtimes detected: ${globalCurrentInstanceSetters
-            .map(fn => fn.version)
-            .join(', ')}.\n` +
-            `This likely means there are multiple versions of Vue ` +
-            `duplicated in your dependency tree, and could lead to errors. ` +
-            `To avoid this warning, ensure that the all imports of Vue are resolving to ` +
-            `the same location on disk.`
-        )
-        hasWarnedDuplicatedVue = true
-      }
       globalCurrentInstanceSetters.forEach(s => s(instance))
     } else {
       globalCurrentInstanceSetters[0](instance)