fix(reactivity): fix dev-only memory leak by updating dep.subsHead on sub removal

ref #11956
This commit is contained in:
Evan You 2024-09-20 19:59:39 +08:00
parent f927a4ae6f
commit 5c8b76ed6c
No known key found for this signature in database
GPG Key ID: 00E9AB7A6704CE0A
1 changed files with 4 additions and 0 deletions

View 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