]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(reactivity): allow collect effects in EffectScope (#13657)
authorzhiyuanzmj <260480378@qq.com>
Fri, 18 Jul 2025 09:01:58 +0000 (17:01 +0800)
committerGitHub <noreply@github.com>
Fri, 18 Jul 2025 09:01:58 +0000 (17:01 +0800)
close #13656

packages/reactivity/src/effectScope.ts

index 9d8dd546e10a3a3ad8f16115e7c1098e48795b57..36c9b85e8d73df41f934a911e0ba6045e2186255 100644 (file)
@@ -1,11 +1,5 @@
 import { EffectFlags, cleanup } from './effect'
-import {
-  type Link,
-  type ReactiveNode,
-  link,
-  setActiveSub,
-  unlink,
-} from './system'
+import { type Link, type ReactiveNode, link, unlink } from './system'
 import { warn } from './warning'
 
 export let activeEffectScope: EffectScope | undefined
@@ -65,14 +59,12 @@ export class EffectScope implements ReactiveNode {
   }
 
   run<T>(fn: () => T): T | undefined {
-    const prevSub = setActiveSub()
     const prevScope = activeEffectScope
     try {
       activeEffectScope = this
       return fn()
     } finally {
       activeEffectScope = prevScope
-      setActiveSub(prevSub)
     }
   }