File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
packages/runtime-core/src/components Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ import {
1212 cloneVNode ,
1313 isVNode ,
1414 VNodeProps ,
15- invokeVNodeHook
15+ invokeVNodeHook ,
16+ isSameVNodeType
1617} from '../vnode'
1718import { warn } from '../warning'
1819import {
@@ -193,7 +194,7 @@ const KeepAliveImpl: ComponentOptions = {
193194
194195 function pruneCacheEntry ( key : CacheKey ) {
195196 const cached = cache . get ( key ) as VNode
196- if ( ! current || cached . type !== current . type ) {
197+ if ( ! current || ! isSameVNodeType ( cached , current ) ) {
197198 unmount ( cached )
198199 } else if ( current ) {
199200 // current active instance should no longer be kept-alive.
@@ -230,7 +231,7 @@ const KeepAliveImpl: ComponentOptions = {
230231 cache . forEach ( cached => {
231232 const { subTree, suspense } = instance
232233 const vnode = getInnerChild ( subTree )
233- if ( cached . type === vnode . type ) {
234+ if ( cached . type === vnode . type && cached . key === vnode . key ) {
234235 // current instance will be unmounted as part of keep-alive's unmount
235236 resetShapeFlag ( vnode )
236237 // but invoke its deactivated hook here
You can’t perform that action at this time.
0 commit comments