Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

refactor(dashboard): drop the unused savePending flag from useConfigSave

Yudhi Armyndharis0e7102d59c9e
diff --git a/dashboard/src/hooks/useConfigSave.ts b/dashboard/src/hooks/useConfigSave.ts
index baa020ddf..c1a3cb0e8 100644
--- a/dashboard/src/hooks/useConfigSave.ts
+++ b/dashboard/src/hooks/useConfigSave.ts
@@ -11,28 +11,24 @@ export interface UseConfigSaveArgs {
export interface ConfigSave {
saving: boolean;
- savePending: boolean;
saveConfig: () => Promise<void>;
}
/**
- * Owns the save-configuration request: the in-flight `saving` flag, `savePending` (set once a save
- * succeeds; only a full page reload from a completed restart clears it — see Infrastructure.tsx's
- * envPinNote logic), and the two failure toasts. Hands the new profile list to `onSaved` instead of
- * driving the restart modal directly, so the edge to the restart flow stays one-way.
+ * Owns the save-configuration request: the in-flight `saving` flag and the two failure toasts. Hands
+ * the new profile list to `onSaved` instead of driving the restart modal directly, so the edge to the
+ * restart flow stays one-way.
*/
export function useConfigSave({ buildPayload, onSaved }: UseConfigSaveArgs): ConfigSave {
const { t } = useTranslation();
const toast = useToast();
const [saving, setSaving] = useState(false);
- const [savePending, setSavePending] = useState(false);
const saveConfig = async () => {
setSaving(true);
try {
const result = await infraApi.saveConfig(buildPayload());
if (result.saved) {
- setSavePending(true);
onSaved(result.profiles || []);
} else {
toast.error(t('infrastructure.toasts.saveFailed'), result.message);
@@ -44,5 +40,5 @@ export function useConfigSave({ buildPayload, onSaved }: UseConfigSaveArgs): Con
}
};
- return { saving, savePending, saveConfig };
+ return { saving, saveConfig };
}