]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(KeepAlive): correct condition for caching inner blocks to handle null cases
authordaiwei <daiwei521@126.com>
Thu, 4 Dec 2025 02:43:21 +0000 (10:43 +0800)
committerdaiwei <daiwei521@126.com>
Thu, 4 Dec 2025 02:43:21 +0000 (10:43 +0800)
packages/runtime-vapor/src/components/KeepAlive.ts

index 2e285e6ab3a3792898455d323dcbb5088efcf3f8..cc5df7baefdae35487d79efc895ac6030f6ebf16 100644 (file)
@@ -126,7 +126,7 @@ export const VaporKeepAliveImpl: ObjectVaporComponent = defineVaporComponent({
 
     const processFragment = (frag: DynamicFragment) => {
       const [innerBlock, interop] = getInnerBlock(frag.nodes)
-      if (!innerBlock && !shouldCache(innerBlock!, props, interop)) return
+      if (!innerBlock || !shouldCache(innerBlock!, props, interop)) return
 
       if (interop) {
         if (cache.has(innerBlock.vnode!.type)) {