Clear the cache when disabling the plugin
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user