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.
This commit is contained in:
@@ -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,
|
||||
});
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user