From 2f131f40b6453f804037c35a2f7196d3cff66f8a Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Thu, 1 Dec 2022 13:09:23 +0100 Subject: [PATCH] Clear the cache when disabling the plugin --- src/main.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index 54b9fb0..35adee8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -7,7 +7,7 @@ import { loadSettings, settings, SettingsTab, showExcerpt } from './settings' import { eventBus, EventNames, indexingStep, IndexingStepType } from './globals' import api from './tools/api' import { isFileIndexable, isFilePlaintext } from './tools/utils' -import { OmnisearchCache } from './database' +import { database, OmnisearchCache } from './database' import * as NotesIndex from './notes-index' import { searchEngine } from './search/omnisearch' import { cacheManager } from './cache-manager' @@ -91,9 +91,10 @@ export default class OmnisearchPlugin extends Plugin { executeFirstLaunchTasks(this) } - onunload(): void { + async onunload(): Promise { // @ts-ignore delete globalThis['omnisearch'] + await database.clearCache() } addRibbonButton(): void {