Skip to content

Commit d1681eb

Browse files
fix: default settings to App tab (#4842)
Open new settings tabs on the App section instead of Account and add a regression test for bare settings tabs.
1 parent f4abc33 commit d1681eb

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

apps/desktop/src/settings/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export function TabContentSettings({
6464
}
6565

6666
function SettingsView({ tab }: { tab: Extract<Tab, { type: "settings" }> }) {
67-
const activeTab = tab.state.tab ?? "account";
67+
const activeTab = tab.state.tab ?? "app";
6868
const ref = useRef<HTMLDivElement>(null);
6969
const { atStart, atEnd } = useScrollFade(ref, "vertical", [activeTab]);
7070

apps/desktop/src/sidebar/settings.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ export function SettingsNav() {
9191
const showDontUseThis = isDev || isStaging;
9292

9393
const activeTab =
94-
currentTab?.type === "settings"
95-
? (currentTab.state.tab ?? "account")
96-
: "account";
94+
currentTab?.type === "settings" ? (currentTab.state.tab ?? "app") : "app";
9795

9896
const setActiveTab = useCallback(
9997
(tab: SettingsTab) => {

apps/desktop/src/store/zustand/tabs/basic.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,18 @@ describe("Basic Tab Actions", () => {
131131
});
132132
});
133133

134+
test("openNew defaults bare settings tabs to app", () => {
135+
useTabs.getState().openNew({ type: "settings" });
136+
137+
expect(useTabs.getState()).toHaveCurrentTab({
138+
type: "settings",
139+
state: { tab: "app" },
140+
});
141+
expect(useTabs.getState()).toMatchTabsInOrder([
142+
{ type: "settings", active: true, state: { tab: "app" } },
143+
]);
144+
});
145+
134146
test("select toggles active flag without changing history", () => {
135147
const tabA = createSessionTab({ active: true });
136148
const tabB = createSessionTab({ active: false });

apps/desktop/src/store/zustand/tabs/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export const getDefaultState = (tab: TabInput): Tab => {
214214
return {
215215
...base,
216216
type: "settings",
217-
state: { tab: (tab.state?.tab as SettingsTab) ?? "account" },
217+
state: { tab: (tab.state?.tab as SettingsTab) ?? "app" },
218218
};
219219
case "chat_support":
220220
return {

0 commit comments

Comments
 (0)