فهرست منبع

refactor: remove unnecessary check as filter is always non-null (#11599)

edison 1 سال پیش
والد
کامیت
73fa91fabd
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      packages/runtime-core/src/components/KeepAlive.ts

+ 2 - 2
packages/runtime-core/src/components/KeepAlive.ts

@@ -195,10 +195,10 @@ const KeepAliveImpl: ComponentOptions = {
       _unmount(vnode, instance, parentSuspense, true)
     }
 
-    function pruneCache(filter?: (name: string) => boolean) {
+    function pruneCache(filter: (name: string) => boolean) {
       cache.forEach((vnode, key) => {
         const name = getComponentName(vnode.type as ConcreteComponent)
-        if (name && (!filter || !filter(name))) {
+        if (name && !filter(name)) {
           pruneCacheEntry(key)
         }
       })