The best way to control Claude Code, Codex and more from any computer or phone
fix(web): removing a project returns to the project overview (#20231)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Nelglor committed
Oct 20, 2026 at 00:16 UTC
15c51cbe578400bbe8e209d80b78439a5a05983f
2 files changed
+52
-5
apps/web/src/components/settings/ProjectSettingsPanel.browser.test.tsx
+47
-4
@@ -17,6 +17,7 @@ import { DEFAULT_RESOLVED_KEYBINDINGS } from "@t3tools/shared/keybindings";
17
import {
18
createMemoryHistory,
19
createRootRoute,
20
+ createRoute,
21
createRouter,
22
RouterProvider,
23
} from "@tanstack/react-router";
@@ -118,6 +119,8 @@ import { useComposerDraftStore } from "../../composerDraftStore";
119
import { appAtomRegistry } from "../../rpc/atomRegistry";
120
import { buildSidebarProjectSnapshots } from "../../sidebarProjectGrouping";
121
import { ProjectSettingsPanel } from "./ProjectSettingsPanel";
122
+import type { SettingsScopeSearch } from "./settingsScope";
123
+import { retainSettingsScope, validateSettingsRouteSearch } from "./settingsScopeNavigation";
124
125
const primaryId = EnvironmentId.make("primary");
126
const remoteId = EnvironmentId.make("remote");
@@ -210,11 +213,33 @@ function projectKey() {
213
})[0]!.projectKey;
214
}
215
213
-async function mountPanel() {
216
+async function mountPanel(search: Omit<SettingsScopeSearch, "project"> = {}) {
217
const key = projectKey();
218
+ const rootRoute = createRootRoute();
219
+ const settingsRoute = createRoute({
220
+ getParentRoute: () => rootRoute,
221
+ path: "settings",
222
+ validateSearch: validateSettingsRouteSearch,
223
+ search: { middlewares: [retainSettingsScope] },
224
+ });
225
+ const projectsRoute = createRoute({
226
+ getParentRoute: () => settingsRoute,
227
+ path: "projects",
228
+ component: () => (
229
+ <ProjectSettingsPanel
230
+ projectKey={key}
231
+ environmentId={search.machine ? EnvironmentId.make(search.machine) : null}
232
+ checkoutKey={search.checkout ?? null}
233
+ />
234
+ ),
235
+ });
236
+ const query = new URLSearchParams({ project: key });
237
+ for (const [name, value] of Object.entries(search)) {
238
+ if (value !== undefined) query.set(name, value);
239
+ }
240
const router = createRouter({
216
- routeTree: createRootRoute({ component: () => <ProjectSettingsPanel projectKey={key} /> }),
217
- history: createMemoryHistory({ initialEntries: ["/settings/projects"] }),
241
+ routeTree: rootRoute.addChildren([settingsRoute.addChildren([projectsRoute])]),
242
+ history: createMemoryHistory({ initialEntries: [`/settings/projects?${query}`] }),
243
});
244
await router.load();
245
await act(async () =>
@@ -225,6 +250,7 @@ async function mountPanel() {
250
),
251
);
252
await vi.waitFor(() => expect(nameInput()).not.toBeNull());
253
+ return router;
254
}
255
256
const nameInput = () => container.querySelector<HTMLInputElement>('[aria-label="Project name"]')!;
@@ -292,7 +318,8 @@ describe("project settings permissions", () => {
318
319
it("removes a writable checkout while removal of the mixed group stays denied", async () => {
320
await grant(remoteId, AsyncResult.success(session([])));
295
- await mountPanel();
321
+ const router = await mountPanel();
322
+ const initialHref = router.state.location.href;
323
expect(removeAll().disabled).toBe(true);
324
325
await userEvent.click(removeCheckout("/work/primary"));
@@ -303,6 +330,7 @@ describe("project settings permissions", () => {
330
});
331
await vi.waitFor(() => expect(state.releaseUploads).toHaveBeenCalledOnce());
332
expect(state.clearDraft).toHaveBeenCalledOnce();
333
+ expect(router.state.location.href).toBe(initialHref);
334
});
335
336
it("rechecks every removal target after confirmation before deleting or clearing drafts", async () => {
@@ -356,3 +384,18 @@ describe("project settings permissions", () => {
384
},
385
);
386
});
387
+
388
+it("returns to the project overview after removal, clearing the selection but keeping the environment", async () => {
389
+ state.projects = [state.projects[1]!];
390
+ const router = await mountPanel({ machine: remoteId, checkout: "remote:/work/remote" });
391
+ const removeProject = [...container.querySelectorAll("button")].find(
392
+ (button) => button.textContent === "Remove project",
393
+ )!;
394
+
395
+ await act(async () => userEvent.click(removeProject));
396
+
397
+ await vi.waitFor(() => {
398
+ expect(router.state.location.pathname).toBe("/settings/projects");
399
+ expect(router.state.location.search).toEqual({ machine: remoteId });
400
+ });
401
+});
apps/web/src/components/settings/ProjectSettingsPanel.tsx
+5
-1
@@ -387,7 +387,11 @@ function ProjectDetail({
387
}
388
389
if (isWholeGroup && !hasOtherMembers) {
390
- void navigate({ to: "/", replace: true });
390
+ void navigate({
391
+ to: "/settings/projects",
392
+ search: ({ machine }) => ({ project: undefined, machine, checkout: undefined }),
393
+ replace: true,
394
+ });
395
}
396
};
397