mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
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:
@@ -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() {
|
||||
|
||||
@@ -161,7 +161,7 @@ export function useKeybindingPresetService() {
|
||||
})
|
||||
|
||||
if (result === null) return
|
||||
if (result) {
|
||||
if (result && keybindingStore.currentPresetName !== 'default') {
|
||||
await savePreset(keybindingStore.currentPresetName)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user