Prechádzať zdrojové kódy

fix(KeepAlive): correct condition for caching inner blocks to handle null cases

daiwei 4 mesiacov pred
rodič
commit
71e2495e46

+ 1 - 1
packages/runtime-vapor/src/components/KeepAlive.ts

@@ -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)) {