From: ysj16 <504427021@qq.com> Date: Thu, 11 Jun 2020 21:24:50 +0000 (+0800) Subject: perf: optimize LRU access in keep-alive (#1316) X-Git-Tag: v3.0.0-beta.15~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f2926a33c78b6a6f4752a01b88f7cad809ed302;p=thirdparty%2Fvuejs%2Fcore.git perf: optimize LRU access in keep-alive (#1316) --- diff --git a/packages/runtime-core/src/components/KeepAlive.ts b/packages/runtime-core/src/components/KeepAlive.ts index ead4371748..8301185ddf 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