]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(watch): remove recorded effect on manual stop (#590)
authorYang Mingshan <y.mingshan3@gmail.com>
Wed, 8 Jan 2020 17:06:16 +0000 (01:06 +0800)
committerEvan You <yyx990803@gmail.com>
Wed, 8 Jan 2020 17:06:16 +0000 (12:06 -0500)
packages/runtime-core/src/apiWatch.ts

index 0bcfbde147eaf628bc9c16176eb25b2a9cd0453b..4760344c4af15eaa3eff8887c40b012a0c9b35b8 100644 (file)
@@ -217,6 +217,13 @@ function doWatch(
   recordEffect(runner)
   return () => {
     stop(runner)
+    if (instance) {
+      const effects = instance.effects!
+      const index = effects.indexOf(runner)
+      if (index > -1) {
+        effects.splice(index, 1)
+      }
+    }
   }
 }