]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
perf(reactivity): optimize effect run condition
authorEvan You <yyx990803@gmail.com>
Fri, 21 Jan 2022 01:41:54 +0000 (09:41 +0800)
committerEvan You <yyx990803@gmail.com>
Fri, 21 Jan 2022 01:41:58 +0000 (09:41 +0800)
packages/reactivity/src/effect.ts

index 351fc0c26332cdb3c8360d03721bd0e73b860001..bb4ed09fa32443262acba171a2ea544064132c0e 100644 (file)
@@ -75,7 +75,7 @@ export class ReactiveEffect<T = any> {
     if (!this.active) {
       return this.fn()
     }
-    if (!effectStack.includes(this)) {
+    if (!effectStack.length || !effectStack.includes(this)) {
       try {
         effectStack.push((activeEffect = this))
         enableTracking()