fix: resolve save preset modal scope issue

- Remove nested x-data from save preset modal to fix scope access
- Add newPresetName to parent component state
- Ensure savingPreset state is correctly accessed from the button
- Clear input field on modal open and after successful save
This commit is contained in:
simon-ami
2026-01-13 16:28:34 +01:00
parent 12d196f6a0
commit f201df4718
2 changed files with 14 additions and 11 deletions

View File

@@ -18,6 +18,7 @@ window.Components.claudeConfig = () => ({
savingPreset: false,
deletingPreset: false,
pendingPresetName: '', // For unsaved changes confirmation
newPresetName: '', // For save preset modal input
// Model fields that may contain Gemini model names
geminiModelFields: [
@@ -307,7 +308,8 @@ window.Components.claudeConfig = () => ({
* Save the current config as a new preset
*/
async saveCurrentAsPreset() {
// Show the save preset modal
// Clear the input and show the save preset modal
this.newPresetName = '';
document.getElementById('save_preset_modal').showModal();
},
@@ -354,6 +356,7 @@ window.Components.claudeConfig = () => ({
if (data.status === 'ok') {
this.presets = data.presets || [];
this.selectedPresetName = name.trim();
this.newPresetName = ''; // Clear the input
Alpine.store('global').showToast(
Alpine.store('global').t('presetSaved') || `Preset "${name}" saved`,
'success'