Skip to content

Commit

Permalink
fix(reactivity): fix memory leak by updating dep.subsHead on sub removal
Browse files Browse the repository at this point in the history
ref #11956
  • Loading branch information
yyx990803 committed Sep 20, 2024
1 parent f927a4a commit 1d9c53d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/reactivity/src/effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,10 @@ function removeSub(link: Link) {
// was previous tail, point new tail to prev
dep.subs = prevSub
}
if (dep.subsHead === link) {
// was previous head, point new head to next
dep.subsHead = nextSub
}

if (!dep.subs && dep.computed) {
// last subscriber removed
Expand Down

0 comments on commit 1d9c53d

Please sign in to comment.