Keep selected projects when switching hosts (#2700)

* fix(app): preserve project selection across hosts

Rendered project identity and persisted equivalence were conflated after duplicate-project handling. Keep them separate so host changes resolve selectable equivalents deterministically without resetting legacy sidebar identity.

* fix(app): restore selected clone after host round trip

Keep manual origin and current destination placements separately so switching back restores the chosen checkout while archive gaps preserve the active host selection.

* fix(app): key status icons by project view

* fix(app): preserve origin during archive gaps
This commit is contained in:
Mohamed Boudra
2026-07-31 15:42:08 +02:00
committed by GitHub
parent 87ef631ac4
commit 99eca19a76
56 changed files with 1234 additions and 428 deletions
@@ -202,7 +202,7 @@ vi.mock("@/hooks/use-projects", () => ({
}));
vi.mock("@/projects/project-icons", () => ({
useProjectIconDataByProjectKey: () => new Map(),
useProjectIconDataByProjectViewKey: () => new Map(),
}));
import ProjectsScreen from "./projects-screen";
@@ -239,7 +239,7 @@ function project(overrides: Partial<ProjectSummary> = {}): ProjectSummary {
overrides.totalWorkspaceCount ?? hosts.reduce((sum, host) => sum + host.workspaceCount, 0);
const onlineHostCount = overrides.onlineHostCount ?? hosts.filter((h) => h.isOnline).length;
return {
projectKey: "remote:github.com/acme/app",
viewKey: "remote:github.com/acme/app",
projectName: "acme/app",
hosts,
totalWorkspaceCount,
@@ -323,7 +323,7 @@ describe("ProjectsScreen", () => {
it("navigates to the project detail route when the row is pressed", () => {
setProjectsState({
projects: [project({ projectKey: "remote:github.com/acme/app" })],
projects: [project({ viewKey: "remote:github.com/acme/app" })],
});
render({ kind: "projects" });
@@ -339,7 +339,7 @@ describe("ProjectsScreen", () => {
it("does not render a kebab menu on the row", () => {
setProjectsState({
projects: [project({ projectKey: "remote:github.com/acme/app" })],
projects: [project({ viewKey: "remote:github.com/acme/app" })],
});
render({ kind: "projects" });
@@ -388,9 +388,9 @@ describe("ProjectsScreen", () => {
it("highlights the selected row when the active view targets a project", () => {
setProjectsState({
projects: [
project({ projectKey: "remote:github.com/acme/app" }),
project({ viewKey: "remote:github.com/acme/app" }),
project({
projectKey: "remote:github.com/acme/other",
viewKey: "remote:github.com/acme/other",
projectName: "acme/other",
githubUrl: "https://github.com/acme/other",
}),