Просмотр исходного кода

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

daiwei 4 месяцев назад
Родитель
Сommit
71e2495e46
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      packages/runtime-vapor/src/components/KeepAlive.ts

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