]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
perf: optimize LRU access in keep-alive (#1316)
authorysj16 <504427021@qq.com>
Thu, 11 Jun 2020 21:24:50 +0000 (05:24 +0800)
committerGitHub <noreply@github.com>
Thu, 11 Jun 2020 21:24:50 +0000 (17:24 -0400)
packages/runtime-core/src/components/KeepAlive.ts

index ead43717483578806d04c0390bac99b400010a8b..8301185ddf637aa34685197d26e3567aa0db90f7 100644 (file)
@@ -226,7 +226,7 @@ const KeepAliveImpl = {
         keys.add(key)
         // prune oldest entry
         if (max && keys.size > parseInt(max as string, 10)) {
-          pruneCacheEntry(Array.from(keys)[0])
+          pruneCacheEntry(keys.values().next().value)
         }
       }
       // avoid vnode being unmounted