fix(app): preserve saved host shell on reconnect

This commit is contained in:
Mohamed Boudra
2026-06-12 08:40:29 +07:00
parent cd0aaed1e2
commit 75aa626df5
2 changed files with 5 additions and 16 deletions
@@ -279,23 +279,14 @@ describe("resolveStartupRoute", () => {
).toEqual({ kind: "redirect", href: "/h/srv-desktop" }); ).toEqual({ kind: "redirect", href: "/h/srv-desktop" });
}); });
it("keeps root startup on the splash while a saved host reconnects", () => { it("keeps a known connecting host in app-owned routing instead of showing welcome", () => {
expect(
resolveStartupRoute({
...baseIndexInput,
hosts: [{ serverId: "server-saved" }],
}),
).toEqual({ kind: "splash" });
});
it("shows welcome after root startup gives up waiting for a saved offline host", () => {
expect( expect(
resolveStartupRoute({ resolveStartupRoute({
...baseIndexInput, ...baseIndexInput,
hosts: [{ serverId: "server-saved" }], hosts: [{ serverId: "server-saved" }],
hasGivenUpWaitingForHost: true, hasGivenUpWaitingForHost: true,
}), }),
).toEqual({ kind: "redirect", href: "/welcome" }); ).toEqual({ kind: "redirect", href: "/h/server-saved" });
}); });
it("shows welcome after root startup gives up and no host exists", () => { it("shows welcome after root startup gives up and no host exists", () => {
@@ -183,11 +183,9 @@ function resolveReadyIndexStartupRoute(input: ResolveIndexStartupRouteInput): St
return { kind: "redirect", href: buildHostRootRoute(input.anyOnlineHostServerId) }; return { kind: "redirect", href: buildHostRootRoute(input.anyOnlineHostServerId) };
} }
if (workspaceSelection) { const savedHostServerId = input.hosts[0]?.serverId ?? null;
const fallbackServerId = input.hosts[0]?.serverId ?? null; if (savedHostServerId) {
if (fallbackServerId) { return { kind: "redirect", href: buildHostRootRoute(savedHostServerId) };
return { kind: "redirect", href: buildHostRootRoute(fallbackServerId) };
}
} }
if (input.hasGivenUpWaitingForHost) { if (input.hasGivenUpWaitingForHost) {