fix: move initPresets to onMounted and prevent saving default preset

Address CodeRabbit review findings:
- Move fire-and-forget initPresets() call into onMounted lifecycle hook
- Skip savePreset when switching away from default preset to avoid
  writing keybindings/default.json
This commit is contained in:
Johnpaul
2026-03-09 23:38:46 +01:00
parent 83701d2bbd
commit da144c709d
2 changed files with 3 additions and 3 deletions

View File

@@ -161,7 +161,7 @@ import Dialog from 'primevue/dialog'
import InputText from 'primevue/inputtext'
import Message from 'primevue/message'
import Tag from 'primevue/tag'
import { computed, ref, watchEffect } from 'vue'
import { computed, onMounted, ref, watchEffect } from 'vue'
import { useI18n } from 'vue-i18n'
import DropdownMenu from '@/components/common/DropdownMenu.vue'
@@ -210,7 +210,7 @@ async function initPresets() {
}
}
initPresets()
onMounted(() => initPresets())
// "..." menu entries (teleported to header)
async function saveAsNewPreset() {

View File

@@ -161,7 +161,7 @@ export function useKeybindingPresetService() {
})
if (result === null) return
if (result) {
if (result && keybindingStore.currentPresetName !== 'default') {
await savePreset(keybindingStore.currentPresetName)
}
}