From 29f988051152fac021f3a892b7b412d184d1a3e0 Mon Sep 17 00:00:00 2001 From: Yang Mingshan Date: Sun, 31 Dec 2023 00:47:25 +0800 Subject: [PATCH] fix(watch): remove instance unmounted short circuit in getter of `watchEffect` --- packages/runtime-core/src/apiWatch.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/runtime-core/src/apiWatch.ts b/packages/runtime-core/src/apiWatch.ts index 0c13e72988f..7439acee543 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,9 +219,7 @@ function doWatch( ) } - const instance = - getCurrentScope() === currentInstance?.scope ? currentInstance : null - // const instance = currentInstance + const instance = currentInstance let getter: () => any let forceTrigger = false let isMultiSource = false @@ -259,9 +256,6 @@ function doWatch( } else { // no cb -> simple effect getter = () => { - if (instance && instance.isUnmounted) { - return - } if (cleanup) { cleanup() }