File tree 1 file changed +4
-3
lines changed
packages/runtime-core/src/components
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ import {
12
12
cloneVNode ,
13
13
isVNode ,
14
14
VNodeProps ,
15
- invokeVNodeHook
15
+ invokeVNodeHook ,
16
+ isSameVNodeType
16
17
} from '../vnode'
17
18
import { warn } from '../warning'
18
19
import {
@@ -193,7 +194,7 @@ const KeepAliveImpl: ComponentOptions = {
193
194
194
195
function pruneCacheEntry ( key : CacheKey ) {
195
196
const cached = cache . get ( key ) as VNode
196
- if ( ! current || cached . type !== current . type ) {
197
+ if ( ! current || ! isSameVNodeType ( cached , current ) ) {
197
198
unmount ( cached )
198
199
} else if ( current ) {
199
200
// current active instance should no longer be kept-alive.
@@ -230,7 +231,7 @@ const KeepAliveImpl: ComponentOptions = {
230
231
cache . forEach ( cached => {
231
232
const { subTree, suspense } = instance
232
233
const vnode = getInnerChild ( subTree )
233
- if ( cached . type === vnode . type ) {
234
+ if ( cached . type === vnode . type && cached . key === vnode . key ) {
234
235
// current instance will be unmounted as part of keep-alive's unmount
235
236
resetShapeFlag ( vnode )
236
237
// but invoke its deactivated hook here
You can’t perform that action at this time.
0 commit comments