Explorar o código

perf: optimize LRU access in keep-alive (#1316)

ysj16 %!s(int64=5) %!d(string=hai) anos
pai
achega
1f2926a33c
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      packages/runtime-core/src/components/KeepAlive.ts

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

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