瀏覽代碼

fix(reactivity): properly cleanup effectScope

daiwei 9 月之前
父節點
當前提交
ea6c064838
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      packages/reactivity/src/effect.ts

+ 2 - 2
packages/reactivity/src/effect.ts

@@ -271,12 +271,12 @@ export function resetTracking(): void {
 export function cleanup(
   sub: ReactiveNode & { cleanups: (() => void)[]; cleanupsLength: number },
 ): void {
-  const l = sub.cleanupsLength
+  const l = sub.cleanups.length
   if (l) {
     for (let i = 0; i < l; i++) {
       sub.cleanups[i]()
     }
-    sub.cleanupsLength = 0
+    sub.cleanups.length = sub.cleanupsLength = 0
   }
 }