MCPcopy
hub / github.com/vuejs/core / pruneCache

Function pruneCache

packages/runtime-core/src/components/KeepAlive.ts:203–216  ·  view source on GitHub ↗
(filter: (name: string) => boolean)

Source from the content-addressed store, hash-verified

201 }
202
203 function pruneCache(filter: (name: string) => boolean) {
204 cache.forEach((vnode, key) => {
205 // for async components, name check should be based in its loaded
206 // inner component if available
207 const name = getComponentName(
208 isAsyncWrapper(vnode)
209 ? (vnode.type as ComponentOptions).__asyncResolved || {}
210 : (vnode.type as ConcreteComponent),
211 )
212 if (name && !filter(name)) {
213 pruneCacheEntry(key)
214 }
215 })
216 }
217
218 function pruneCacheEntry(key: CacheKey) {
219 const cached = cache.get(key) as VNode

Callers 1

setupFunction · 0.85

Calls 5

getComponentNameFunction · 0.90
isAsyncWrapperFunction · 0.90
filterFunction · 0.85
pruneCacheEntryFunction · 0.85
forEachMethod · 0.80

Tested by

no test coverage detected