From ffbe87e7a3bda9666245e7e5b1565cd35b9cc5ea Mon Sep 17 00:00:00 2001 From: daiwei Date: Tue, 31 Dec 2024 16:11:41 +0800 Subject: [PATCH] fix(runtime-core): prevent updating instance if it's already the current instance --- packages/runtime-core/src/component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/runtime-core/src/component.ts b/packages/runtime-core/src/component.ts index 3ed42ed0b..cf8a17e9d 100644 --- a/packages/runtime-core/src/component.ts +++ b/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()