diff --git a/src/client/theme-default/components/VPLocalSearchBox.vue b/src/client/theme-default/components/VPLocalSearchBox.vue index 07b1bd15..24dac640 100644 --- a/src/client/theme-default/components/VPLocalSearchBox.vue +++ b/src/client/theme-default/components/VPLocalSearchBox.vue @@ -148,6 +148,11 @@ const cache = new LRUCache>(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 diff --git a/src/client/theme-default/support/lru.ts b/src/client/theme-default/support/lru.ts index bad3f2b4..b6673512 100644 --- a/src/client/theme-default/support/lru.ts +++ b/src/client/theme-default/support/lru.ts @@ -30,4 +30,8 @@ export class LRUCache { first(): K | undefined { return this.cache.keys().next().value } + + clear(): void { + this.cache.clear() + } }