]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(reactivity): fix dev-only memory leak by updating dep.subsHead on sub removal
authorEvan You <evan@vuejs.org>
Fri, 20 Sep 2024 11:59:39 +0000 (19:59 +0800)
committerEvan You <evan@vuejs.org>
Fri, 20 Sep 2024 12:06:39 +0000 (20:06 +0800)
ref #11956

packages/reactivity/src/effect.ts

index b8dd62a0f6ee7253b6393cb19f92170a3d8b1e0b..64e4e94be51ea31c8bd524d0c77b0dceee72ee5e 100644 (file)
@@ -413,6 +413,10 @@ function removeSub(link: Link) {
     // was previous tail, point new tail to prev
     dep.subs = prevSub
   }
+  if (__DEV__ && dep.subsHead === link) {
+    // was previous head, point new head to next
+    dep.subsHead = nextSub
+  }
 
   if (!dep.subs && dep.computed) {
     // last subscriber removed