Keep New Workspace on the current project (#1806)

* fix(app): keep New Workspace on the active project

New Workspace preselection was falling back to stale remembered host state when multiple hosts existed. Pass durable active-project context from workspace entry points and centralize initial host selection so stale offline hosts cannot steal the form while startup restore remains last-workspace only.

* fix(app): address New Workspace review feedback

* fix(app): stabilize New Workspace host selection

* fix(app): preserve New Workspace host fallback

* test(app): loosen stale-host project assertion

* fix(app): prefer reachable new workspace hosts

* fix(app): avoid stale offline workspace preselect

* fix(app): prefer online project hosts
This commit is contained in:
Mohamed Boudra
2026-06-29 20:44:18 +02:00
committed by GitHub
parent 0614618d2f
commit f94ec0e430
13 changed files with 1171 additions and 116 deletions
@@ -262,6 +262,18 @@ describe("resolveStartupRoute", () => {
).toEqual({ kind: "redirect", href: "/h/server-1" });
});
it("restores the last workspace host even when a different host is already online", () => {
expect(
resolveStartupRoute({
...baseIndexInput,
hosts: [{ serverId: "server-offline" }, { serverId: "server-online" }],
anyOnlineHostServerId: "server-online",
workspaceSelection: { serverId: "server-offline", workspaceId: "workspace-a" },
workspaceSelectionStatus: "unknown",
}),
).toEqual({ kind: "redirect", href: "/h/server-offline" });
});
it("does not restore a saved workspace after workspace hydration proves it is missing", () => {
expect(
resolveStartupRoute({