Skip to content

Commit 5c8b76e

Browse files
committed
fix(reactivity): fix dev-only memory leak by updating dep.subsHead on sub removal
ref #11956
1 parent f927a4a commit 5c8b76e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/reactivity/src/effect.ts

+4
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,10 @@ function removeSub(link: Link) {
413413
// was previous tail, point new tail to prev
414414
dep.subs = prevSub
415415
}
416+
if (__DEV__ && dep.subsHead === link) {
417+
// was previous head, point new head to next
418+
dep.subsHead = nextSub
419+
}
416420

417421
if (!dep.subs && dep.computed) {
418422
// last subscriber removed

0 commit comments

Comments
 (0)