]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): prevent updating instance if it's already the current instance
authordaiwei <daiwei521@126.com>
Tue, 31 Dec 2024 08:11:41 +0000 (16:11 +0800)
committerdaiwei <daiwei521@126.com>
Tue, 31 Dec 2024 08:11:41 +0000 (16:11 +0800)
packages/runtime-core/src/component.ts

index 3ed42ed0b55bec8c89976c6d010c878b7b196325..cf8a17e9d2b67e766c8fe5b6c98842c7dc17f692 100644 (file)
@@ -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()