From: Evan You Date: Fri, 20 Sep 2024 11:59:39 +0000 (+0800) Subject: fix(reactivity): fix dev-only memory leak by updating dep.subsHead on sub removal X-Git-Tag: v3.5.7~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c8b76ed6cfbbcee4cbaac0b72beab7291044e4f;p=thirdparty%2Fvuejs%2Fcore.git fix(reactivity): fix dev-only memory leak by updating dep.subsHead on sub removal ref #11956 --- diff --git a/packages/reactivity/src/effect.ts b/packages/reactivity/src/effect.ts index b8dd62a0f6..64e4e94be5 100644 --- a/packages/reactivity/src/effect.ts +++ b/packages/reactivity/src/effect.ts @@ -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