mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 12:18:54 +00:00
fix(keep-alive): fix memory leak without breaking transition tests
This commit is contained in:
parent
2632249925
commit
e0747f40a8
@ -33,10 +33,15 @@ function matches(
|
||||
}
|
||||
|
||||
function pruneCache(
|
||||
keepAliveInstance: { cache: CacheEntryMap; keys: string[]; _vnode: VNode },
|
||||
keepAliveInstance: {
|
||||
cache: CacheEntryMap
|
||||
keys: string[]
|
||||
_vnode: VNode
|
||||
$vnode: VNode
|
||||
},
|
||||
filter: Function
|
||||
) {
|
||||
const { cache, keys, _vnode } = keepAliveInstance
|
||||
const { cache, keys, _vnode, $vnode } = keepAliveInstance
|
||||
for (const key in cache) {
|
||||
const entry = cache[key]
|
||||
if (entry) {
|
||||
@ -46,6 +51,7 @@ function pruneCache(
|
||||
}
|
||||
}
|
||||
}
|
||||
$vnode.componentOptions!.children = undefined
|
||||
}
|
||||
|
||||
function pruneCacheEntry(
|
||||
|
@ -62,8 +62,6 @@ const componentVNodeHooks = {
|
||||
vnode, // new parent vnode
|
||||
options.children // new children
|
||||
)
|
||||
// #12187 unset children reference after use to avoid memory leak
|
||||
options.children = undefined
|
||||
},
|
||||
|
||||
insert(vnode: MountedComponentVNode) {
|
||||
|
Loading…
Reference in New Issue
Block a user