fix(keep-alive): handle "0" as cache key (#1622)

fix #1621
This commit is contained in:
zhangzhonghe
2020-07-20 01:31:07 +08:00
committed by GitHub
parent 8facaefcc3
commit 2deb0c7a74
2 changed files with 59 additions and 2 deletions

View File

@@ -182,7 +182,8 @@ const KeepAliveImpl = {
// cache sub tree in beforeMount/Update (i.e. right after the render)
let pendingCacheKey: CacheKey | null = null
const cacheSubtree = () => {
if (pendingCacheKey) {
// fix #1621, the pendingCacheKey could be 0
if (pendingCacheKey != null) {
cache.set(pendingCacheKey, instance.subTree)
}
}