From 0cf1c5353e19e66a975662e2578a0d4f9aca69e9 Mon Sep 17 00:00:00 2001 From: Daniel Volz Date: Sat, 21 Feb 2026 17:59:50 +0100 Subject: [PATCH] fix: notification channel toggles snap back after being enabled (#255) * fix: notification channel toggles snap back after being enabled The checked props for email/push notification toggles had redundant conditions (smtpHost/shoutrrrUrl checks) that forced them to false, causing immediate visual snap-back. Additionally, performSave() overwrote emailEnabled/shoutrrrEnabled in local state with effective values, disabling toggles when no SMTP host or Shoutrrr URL was set. Remove redundant checked prop conditions (disabled attr already handles interaction gating) and stop overwriting enabled flags in local state after save. Closes #250 * fix: remove leaked useModalHistory import from SettingsPage * fix: update useSettings tests to match new toggle behavior --- frontend/src/hooks/useSettings.ts | 6 +----- frontend/src/pages/SettingsPage.tsx | 22 ++++++--------------- frontend/src/test/hooks/useSettings.test.ts | 7 ++++--- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/frontend/src/hooks/useSettings.ts b/frontend/src/hooks/useSettings.ts index b63ceaa..320416c 100644 --- a/frontend/src/hooks/useSettings.ts +++ b/frontend/src/hooks/useSettings.ts @@ -249,11 +249,7 @@ export function useSettings(): UseSettingsReturn { body: JSON.stringify(payload), }).catch(() => null); - const updatedSettings = { - ...settingsToSave, - emailEnabled: effectiveEmailEnabled, - shoutrrrEnabled: effectiveShoutrrrEnabled, - }; + const updatedSettings = { ...settingsToSave }; setSettings(updatedSettings); setSettingsSaving(false); setSavedSettings(updatedSettings); diff --git a/frontend/src/pages/SettingsPage.tsx b/frontend/src/pages/SettingsPage.tsx index e79c661..b332d3c 100644 --- a/frontend/src/pages/SettingsPage.tsx +++ b/frontend/src/pages/SettingsPage.tsx @@ -89,7 +89,7 @@ export function SettingsPage() {