cloneVNode,
isVNode,
VNodeProps,
- invokeVNodeHook
+ invokeVNodeHook,
+ isSameVNodeType
} from '../vnode'
import { warn } from '../warning'
import {
function pruneCacheEntry(key: CacheKey) {
const cached = cache.get(key) as VNode
- if (!current || cached.type !== current.type) {
+ if (!current || !isSameVNodeType(cached, current)) {
unmount(cached)
} else if (current) {
// current active instance should no longer be kept-alive.
cache.forEach(cached => {
const { subTree, suspense } = instance
const vnode = getInnerChild(subTree)
- if (cached.type === vnode.type) {
+ if (cached.type === vnode.type && cached.key === vnode.key) {
// current instance will be unmounted as part of keep-alive's unmount
resetShapeFlag(vnode)
// but invoke its deactivated hook here