chore: clear local search cache on hmr

pull/3187/head
Divyansh Singh 1 year ago
parent 878f4378cd
commit ed2ae3a25b

@ -148,6 +148,11 @@ const cache = new LRUCache<string, Map<string, string>>(16) // 16 files
debouncedWatch(
() => [searchIndex.value, filterText.value, showDetailedList.value] as const,
async ([index, filterTextValue, showDetailedListValue], old, onCleanup) => {
if (old?.[0] !== index) { // in case of hmr
cache.clear()
}
let canceled = false
onCleanup(() => {
canceled = true

@ -30,4 +30,8 @@ export class LRUCache<K, V> {
first(): K | undefined {
return this.cache.keys().next().value
}
clear(): void {
this.cache.clear()
}
}

Loading…
Cancel
Save