From f300a4001ec40cadef2520267eb5841ab48cf005 Mon Sep 17 00:00:00 2001 From: Yang Mingshan Date: Wed, 3 Jan 2024 18:09:53 +0800 Subject: [PATCH] fix(watch): remove instance unmounted short circuit in getter of `watchEffect` (#9948) --- packages/runtime-core/src/apiWatch.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/runtime-core/src/apiWatch.ts b/packages/runtime-core/src/apiWatch.ts index 7e1e250bd64..665fb4ec4df 100644 --- a/packages/runtime-core/src/apiWatch.ts +++ b/packages/runtime-core/src/apiWatch.ts @@ -5,7 +5,6 @@ import { ReactiveEffect, ReactiveFlags, type Ref, - getCurrentScope, isReactive, isRef, isShallow, @@ -220,8 +219,7 @@ function doWatch( ) } - const instance = - getCurrentScope() === currentInstance?.scope ? currentInstance : null + const instance = currentInstance const reactiveGetter = (source: object) => deep === true ? source // traverse will happen in wrapped getter below @@ -261,9 +259,6 @@ function doWatch( } else { // no cb -> simple effect getter = () => { - if (instance && instance.isUnmounted) { - return - } if (cleanup) { cleanup() }