Преглед на файлове

fix(runtime-core): prevent updating instance if it's already the current instance

daiwei преди 1 година
родител
ревизия
ffbe87e7a3
променени са 1 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 4 1
      packages/runtime-core/src/component.ts

+ 4 - 1
packages/runtime-core/src/component.ts

@@ -760,7 +760,10 @@ if (__SSR__) {
   }
 }
 
-export const setCurrentInstance = (instance: ComponentInternalInstance) => {
+export const setCurrentInstance = (
+  instance: ComponentInternalInstance,
+): (() => void) => {
+  if (currentInstance === instance) return NOOP
   const prev = currentInstance
   internalSetCurrentInstance(instance)
   instance.scope.on()