Removed forced cache saving

This commit is contained in:
Simon Cambier 2025-06-21 13:35:59 +02:00
parent d85a132e50
commit 88923910aa
4 changed files with 2 additions and 19 deletions

View File

@ -285,7 +285,7 @@ export default class LocatorPlugin extends Plugin {
// Disable settings.useCache while writing the cache, in case it freezes
const cacheEnabled = this.settings.useCache
if (cacheEnabled && !this.settings.DANGER_forceSaveCache) {
if (cacheEnabled) {
this.settings.useCache = false
await saveSettings(this)
}

View File

@ -127,7 +127,6 @@ export function getDefaultSettings(app: App): LocatorSettings {
verboseLogging: false,
DANGER_httpHost: null,
DANGER_forceSaveCache: false,
}
}

View File

@ -1,7 +1,7 @@
import { Setting } from 'obsidian'
import type LocatorPlugin from 'src/main'
import type { LocatorSettings } from './utils'
import { htmlDescription, isCacheEnabled, needsARestart, saveSettings } from './utils'
import { htmlDescription, isCacheEnabled, needsARestart } from './utils'
export function injectSettingsDanger(
plugin: LocatorPlugin,
@ -12,21 +12,6 @@ export function injectSettingsDanger(
new Setting(containerEl).setName('Danger Zone').setHeading()
// Force save cache
new Setting(containerEl)
.setName('Force save the cache')
.setDesc(
htmlDescription(`Locator has a security feature that automatically disables cache writing if it cannot fully perform the operation.<br>
Use this option to force the cache to be saved, even if it causes a crash.<br>
<span style="color: var(--text-accent)">Enabling this setting could lead to crash loops</span>`)
)
.addToggle(toggle =>
toggle.setValue(settings.DANGER_forceSaveCache).onChange(async v => {
settings.DANGER_forceSaveCache = v
await saveSettings(plugin)
})
)
// Clear cache data
if (isCacheEnabled()) {
new Setting(containerEl)

View File

@ -82,5 +82,4 @@ export interface LocatorSettings extends WeightingSettings {
httpApiNotice: boolean
DANGER_httpHost: string | null
DANGER_forceSaveCache: boolean
}