Skip to content

Commit bff94f3

Browse files
committed
include local tag in keep-alive cache key (fix #3269)
1 parent 5660052 commit bff94f3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/core/components/keep-alive.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ export default {
1414
const rawChild = this.child
1515
const realChild = getRealChild(this.child)
1616
if (realChild && realChild.componentOptions) {
17-
const cid = realChild.componentOptions.Ctor.cid
18-
if (this.cache[cid]) {
19-
const child = realChild.child = this.cache[cid].child
17+
const opts = realChild.componentOptions
18+
// same constructor may get registered as different local components
19+
// so cid alone is not enough (#3269)
20+
const key = opts.Ctor.cid + '::' + opts.tag
21+
if (this.cache[key]) {
22+
const child = realChild.child = this.cache[key].child
2023
realChild.elm = this.$el = child.$el
2124
} else {
22-
this.cache[cid] = realChild
25+
this.cache[key] = realChild
2326
}
2427
realChild.data.keepAlive = true
2528
}

0 commit comments

Comments
 (0)