From 1f2926a33c78b6a6f4752a01b88f7cad809ed302 Mon Sep 17 00:00:00 2001 From: ysj16 <504427021@qq.com> Date: Fri, 12 Jun 2020 05:24:50 +0800 Subject: [PATCH] perf: optimize LRU access in keep-alive (#1316) --- packages/runtime-core/src/components/KeepAlive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/runtime-core/src/components/KeepAlive.ts b/packages/runtime-core/src/components/KeepAlive.ts index ead43717..8301185d 100644 --- a/packages/runtime-core/src/components/KeepAlive.ts +++ b/packages/runtime-core/src/components/KeepAlive.ts @@ -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