Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e0747f4

Browse files
fix(keep-alive): fix memory leak without breaking transition tests
1 parent 2632249 commit e0747f4

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

‎src/core/components/keep-alive.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,15 @@ function matches(
3333
}
3434

3535
function pruneCache(
36-
keepAliveInstance: { cache: CacheEntryMap; keys: string[]; _vnode: VNode },
36+
keepAliveInstance: {
37+
cache: CacheEntryMap
38+
keys: string[]
39+
_vnode: VNode
40+
$vnode: VNode
41+
},
3742
filter: Function
3843
) {
39-
const { cache, keys, _vnode } = keepAliveInstance
44+
const { cache, keys, _vnode, $vnode } = keepAliveInstance
4045
for (const key in cache) {
4146
const entry = cache[key]
4247
if (entry) {
@@ -46,6 +51,7 @@ function pruneCache(
4651
}
4752
}
4853
}
54+
$vnode.componentOptions!.children = undefined
4955
}
5056

5157
function pruneCacheEntry(

‎src/core/vdom/create-component.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ const componentVNodeHooks = {
6262
vnode, // new parent vnode
6363
options.children // new children
6464
)
65-
// #12187 unset children reference after use to avoid memory leak
66-
options.children = undefined
6765
},
6866

6967
insert(vnode: MountedComponentVNode) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /