Skip to content

Commit 0c0b0eb

Browse files
juliusmarmingecodex
andcommitted
fix(web): keep settings navigation history intact
Keep settings entry points on the existing push-then-replace flow while retaining the project projection fix. Co-authored-by: codex <[email protected]>
1 parent 48c34bb commit 0c0b0eb

6 files changed

Lines changed: 4 additions & 20 deletions

File tree

‎apps/web/src/components/AppSidebarLayout.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { useEnvironmentIdentificationMode, useLegacySidebarEnabled } from "../ho
1818
import LegacyThreadSidebar from "./LegacySidebar";
1919
import ThreadSidebar from "./Sidebar";
2020
import { SettingsSidebarNav } from "./settings/SettingsSidebarNav";
21-
import { DEFAULT_SETTINGS_PATH } from "./settings/settingsSearch";
2221
import { SidebarChromeHeader } from "./sidebar/SidebarChrome";
2322
import { useSidebarStageBackdropVariant } from "./SidebarStageBackdrop";
2423
import { useProjects } from "../state/entities";
@@ -182,7 +181,7 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
182181
if (action === "open-settings") {
183182
const isSettingsRoute = /^\/settings(\/|$)/.test(pathname);
184183
if (!isSettingsRoute) {
185-
void navigate({ to: DEFAULT_SETTINGS_PATH });
184+
void navigate({ to: "/settings" });
186185
}
187186
}
188187
});

‎apps/web/src/components/CommandPalette.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ import { ProjectFavicon } from "./ProjectFavicon";
124124
import { ProjectFilePicker } from "./files/ProjectFilePicker";
125125
import { ProjectContentSearchDialog } from "./search/ProjectContentSearchDialog";
126126
import { toggleThemeEditorForTheme } from "./settings/themeEditorStore";
127-
import { DEFAULT_SETTINGS_PATH } from "./settings/settingsSearch";
128127
import { ThreadRowLeadingStatus, ThreadRowTrailingStatus } from "./ThreadStatusIndicators";
129128
import { primaryServerKeybindingsAtom, primaryServerProvidersAtom } from "../state/server";
130129
import { resolveDefaultProviderModelSelection } from "../providerInstances";
@@ -1503,7 +1502,7 @@ function OpenCommandPaletteDialog(props: {
15031502
title: "Open settings",
15041503
icon: <SettingsIcon className={ITEM_ICON_CLASS} />,
15051504
run: async () => {
1506-
await navigate({ to: DEFAULT_SETTINGS_PATH });
1505+
await navigate({ to: "/settings" });
15071506
},
15081507
});
15091508

‎apps/web/src/components/settings/settingsSearch.test.ts‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
import { describe, expect, it } from "vite-plus/test";
22

33
import {
4-
DEFAULT_SETTINGS_PATH,
54
searchableSetting,
65
searchSettings,
76
SETTINGS_SEARCH_ITEMS,
87
type SettingsSearchItem,
98
} from "./settingsSearch";
109

11-
describe("settings entry route", () => {
12-
it("opens the concrete default section without passing through the redirect-only route", () => {
13-
expect(DEFAULT_SETTINGS_PATH).toBe("/settings/general");
14-
});
15-
});
16-
1710
const ITEMS: ReadonlyArray<SettingsSearchItem> = [
1811
{
1912
id: "word-wrap",

‎apps/web/src/components/settings/settingsSearch.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ export type SettingsPath =
77
| "/settings/connections"
88
| "/settings/archived";
99

10-
// In-app entry points target the concrete section so the originating thread
11-
// stays the immediate Back target. Bare `/settings` URLs still replace-redirect
12-
// via the settings route.
13-
export const DEFAULT_SETTINGS_PATH = "/settings/general" satisfies SettingsPath;
14-
1510
export interface SettingsSearchItem {
1611
readonly id: string;
1712
readonly title: string;

‎apps/web/src/components/sidebar/SidebarChrome.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
} from "../ui/sidebar";
2323
import { SidebarProviderUpdatePill } from "./SidebarProviderUpdatePill";
2424
import { SidebarUpdatePill } from "./SidebarUpdatePill";
25-
import { DEFAULT_SETTINGS_PATH } from "../settings/settingsSearch";
2625

2726
export const SidebarChromeHeader = memo(function SidebarChromeHeader({
2827
isElectron,
@@ -116,7 +115,7 @@ export const SidebarChromeFooter = memo(function SidebarChromeFooter() {
116115
if (isMobile) {
117116
setOpenMobile(false);
118117
}
119-
void navigate({ to: DEFAULT_SETTINGS_PATH });
118+
void navigate({ to: "/settings" });
120119
}, [isMobile, navigate, setOpenMobile]);
121120

122121
const handleUsageClick = useCallback(() => {

‎apps/web/src/routes/settings.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
import { useCallback, useEffect, useState } from "react";
1111

1212
import { useSettingsRestore } from "../components/settings/SettingsPanels";
13-
import { DEFAULT_SETTINGS_PATH } from "../components/settings/settingsSearch";
1413
import { Button } from "../components/ui/button";
1514
import { SidebarInset } from "../components/ui/sidebar";
1615
import { isElectron } from "../env";
@@ -130,7 +129,7 @@ export const Route = createFileRoute("/settings")({
130129
}
131130

132131
if (location.pathname === "/settings") {
133-
throw redirect({ to: DEFAULT_SETTINGS_PATH, replace: true });
132+
throw redirect({ to: "/settings/general", replace: true });
134133
}
135134
},
136135
component: SettingsRouteLayout,

0 commit comments

Comments
 (0)