]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(watch): remove instance unmounted short circuit in getter of `watchEffect` (...
authorYang Mingshan <y.mingshan3@gmail.com>
Wed, 3 Jan 2024 10:09:53 +0000 (18:09 +0800)
committerGitHub <noreply@github.com>
Wed, 3 Jan 2024 10:09:53 +0000 (18:09 +0800)
packages/runtime-core/src/apiWatch.ts

index 7e1e250bd64f4f04f8a9e4f34df5a605659220d3..665fb4ec4df1c4aae50e6f12c50b26f9fec350d3 100644 (file)
@@ -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()
         }