@@ -36,13 +36,9 @@ export default function UserSettings({ data }: UserSettingsProps) {
3636 fetchWizardEnv ( ) ;
3737 } , [ ] ) ;
3838
39- // If Integrations tab is selected but disabled, fallback to General
40- useEffect ( ( ) => {
41- if ( tab === 'Integrations' && wizardEnv ?. DISABLE_INTEGRATIONS === 'true' ) {
42- setTab ( 'General' ) ;
43- }
44- // eslint-disable-next-line react-hooks/exhaustive-deps
45- } , [ wizardEnv ?. DISABLE_INTEGRATIONS ] ) ;
39+ // Derive active tab: fallback to General if Integrations is disabled
40+ const activeTab =
41+ tab === 'Integrations' && wizardEnv ?. DISABLE_INTEGRATIONS === 'true' ? 'General' : tab ;
4642
4743 return (
4844 < div className = { classes . containerSettings } >
@@ -52,14 +48,14 @@ export default function UserSettings({ data }: UserSettingsProps) {
5248 < >
5349 < div className = { classes . tabList } >
5450 < button
55- className = { tab === 'General' ? classes . tabListButtonActive : classes . tabListButton }
51+ className = { activeTab === 'General' ? classes . tabListButtonActive : classes . tabListButton }
5652 onClick = { ( ) => setTab ( 'General' ) }
5753 >
5854 General
5955 </ button >
6056 < button
6157 className = {
62- tab === 'Notifications' ? classes . tabListButtonActive : classes . tabListButton
58+ activeTab === 'Notifications' ? classes . tabListButtonActive : classes . tabListButton
6359 }
6460 onClick = { ( ) => setTab ( 'Notifications' ) }
6561 >
@@ -68,7 +64,7 @@ export default function UserSettings({ data }: UserSettingsProps) {
6864 { wizardEnv . DISABLE_INTEGRATIONS !== 'true' && (
6965 < button
7066 className = {
71- tab === 'Integrations' ? classes . tabListButtonActive : classes . tabListButton
67+ activeTab === 'Integrations' ? classes . tabListButtonActive : classes . tabListButton
7268 }
7369 onClick = { ( ) => setTab ( 'Integrations' ) }
7470 >
@@ -77,22 +73,22 @@ export default function UserSettings({ data }: UserSettingsProps) {
7773 ) }
7874 </ div >
7975
80- { tab === 'General' && (
76+ { activeTab === 'General' && (
8177 < >
8278 < PasswordSettings />
8379 < EmailSettings email = { data . user ?. email ?? undefined } />
8480 < UsernameSettings username = { data . user ?. name ?? undefined } />
8581 </ >
8682 ) }
8783
88- { tab === 'Notifications' && (
84+ { activeTab === 'Notifications' && (
8985 < >
9086 < EmailAlertSettings />
9187 < AppriseAlertSettings />
9288 </ >
9389 ) }
9490
95- { tab === 'Integrations' && wizardEnv . DISABLE_INTEGRATIONS !== 'true' && < Integrations /> }
91+ { activeTab === 'Integrations' && wizardEnv . DISABLE_INTEGRATIONS !== 'true' && < Integrations /> }
9692 </ >
9793 ) }
9894 </ div >
0 commit comments