Clear the cache when disabling the plugin

This commit is contained in:
Simon Cambier
2022-12-01 13:09:23 +01:00
parent 843545a38a
commit 2f131f40b6

View File

@@ -7,7 +7,7 @@ import { loadSettings, settings, SettingsTab, showExcerpt } from './settings'
import { eventBus, EventNames, indexingStep, IndexingStepType } from './globals' import { eventBus, EventNames, indexingStep, IndexingStepType } from './globals'
import api from './tools/api' import api from './tools/api'
import { isFileIndexable, isFilePlaintext } from './tools/utils' import { isFileIndexable, isFilePlaintext } from './tools/utils'
import { OmnisearchCache } from './database' import { database, OmnisearchCache } from './database'
import * as NotesIndex from './notes-index' import * as NotesIndex from './notes-index'
import { searchEngine } from './search/omnisearch' import { searchEngine } from './search/omnisearch'
import { cacheManager } from './cache-manager' import { cacheManager } from './cache-manager'
@@ -91,9 +91,10 @@ export default class OmnisearchPlugin extends Plugin {
executeFirstLaunchTasks(this) executeFirstLaunchTasks(this)
} }
onunload(): void { async onunload(): Promise<void> {
// @ts-ignore // @ts-ignore
delete globalThis['omnisearch'] delete globalThis['omnisearch']
await database.clearCache()
} }
addRibbonButton(): void { addRibbonButton(): void {