Explorar el Código

fix(preset): show toast when Save & Apply write fails

Greptile P1 review on 363b981: savePreset is called with silent=true in
the Save & Apply path to avoid a double toast on the happy path, but
silent=true also suppresses the failure toast. If writePreset returns
false (disk full, bad permissions, missing config path) the user got no
feedback and the dialog stayed at Level 2 unchanged.

Add an explicit else branch that shows a 'Save failed' warning toast,
restoring failure feedback without re-introducing the double toast on
success.
Qesire hace 2 semanas
padre
commit
7f33dbe62b
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  1. 10 0
      src/tui-preset.ts

+ 10 - 0
src/tui-preset.ts

@@ -325,6 +325,16 @@ function editPresetWorkingCopy(
                   presetName,
                   'Preset saved & applied',
                 );
+              } else {
+                // savePreset is called silent=true to avoid a double toast on
+                // the happy path, but that also suppresses the failure toast.
+                // Restore explicit feedback so a failed write doesn't leave the
+                // user staring at an unchanged Level 2 dialog with no message.
+                state.api.ui.toast({
+                  variant: 'warning',
+                  title: 'Save failed',
+                  message: `Could not write preset "${presetName}" to the config file.`,
+                });
               }
               break;
             }