fix(settings): default to first rendered tab when Account disabled

This commit is contained in:
2026-06-06 15:14:05 +02:00
parent f0c6c17e4a
commit 17a89cb12d
3 changed files with 25 additions and 15 deletions
@@ -267,8 +267,12 @@ export default function UserSettingsDialog(props: IProps): JSX.Element {
return tabs as NonEmptyArray<Tab<UserTab>>;
};
const defaultTab = moduleSettingsTabs.length > 0 ? (moduleSettingsTabs[0].key as UserTab) : UserTab.Account;
const [activeTabId, _setActiveTabId] = useActiveTabWithDefault(getTabs(), defaultTab, props.initialTabId);
const tabs = getTabs();
// Prefer the first module-registered tab (e.g. HealthChat "Profil"); otherwise fall back to the first
// tab that actually renders. The Account tab is disabled for HealthChat, so it cannot be the default —
// using it would leave no tab active and a blank panel when no module tab is present.
const defaultTab = moduleSettingsTabs.length > 0 ? (moduleSettingsTabs[0].key as UserTab) : tabs[0].id;
const [activeTabId, _setActiveTabId] = useActiveTabWithDefault(tabs, defaultTab, props.initialTabId);
const setActiveTabId = (tabId: UserTab): void => {
_setActiveTabId(tabId);
// Clear these so switching away from the tab and back to it will not show the QR code again