From 6881d92d0ace3ad69bb86f5b6248b7392dfe3d24 Mon Sep 17 00:00:00 2001 From: mrhid6 Date: Mon, 3 Aug 2026 14:13:05 +0100 Subject: [PATCH] fix: local-login toggle no longer reverts unsaved settings edits server/internal/services/settings.go SaveSettings takes alerts and email as required (non-pointer) values and writes them unconditionally - absent fields would blank stored settings, not just leave them alone. onLocalLoginChange was building its payload from the stale loaded settings object instead of the in-progress form state (thresholdMinutes/logRetentionDays) that handleSubmit uses, so editing the offline threshold and then flipping the toggle silently reverted the edit. Both paths now submit the same in-progress values. --- web/app/(app)/settings/page.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/app/(app)/settings/page.tsx b/web/app/(app)/settings/page.tsx index 06a737c..44236ea 100644 --- a/web/app/(app)/settings/page.tsx +++ b/web/app/(app)/settings/page.tsx @@ -195,10 +195,15 @@ export default function SettingsPage() { localLoginEnabled={settings?.local_login_enabled ?? true} onLocalLoginChange={(v) => { if (!settings) return; + // Same in-progress form state the main Save button submits + // (handleSubmit below), not the stale loaded `settings` + // object — otherwise an unsaved edit to the offline + // threshold or retention days is silently reverted the + // moment this toggle is flipped. save({ - alerts: settings.alerts, + alerts: { ...settings.alerts, offline_threshold_minutes: thresholdMinutes }, email: settings.email, - workflow_log_retention_days: settings.workflow_log_retention_days, + workflow_log_retention_days: logRetentionDays, local_login_enabled: v, }); }}