]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor: remove unnecessary check as filter is always non-null (#11599)
authoredison <daiwei521@126.com>
Tue, 13 Aug 2024 14:05:14 +0000 (22:05 +0800)
committerGitHub <noreply@github.com>
Tue, 13 Aug 2024 14:05:14 +0000 (22:05 +0800)
packages/runtime-core/src/components/KeepAlive.ts

index cca1b8d96834dd491d18741314ce51f438b7c0dd..e9c8cce58df2d704bc7bff8450762af25f789e37 100644 (file)
@@ -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)
         }
       })