Skip to content

Commit

Permalink
fix(reactivity): fix dev-only memory leak by updating dep.subsHead on…
Browse files Browse the repository at this point in the history
… sub removal

ref #11956
  • Loading branch information
yyx990803 committed Sep 20, 2024
1 parent f927a4a commit 5c8b76e
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 (__DEV__ && 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 5c8b76e

Please # to comment.