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" });
});
it("keeps root startup on the splash while a saved host reconnects", () => {
expect(
resolveStartupRoute({
...baseIndexInput,
hosts: [{ serverId: "server-saved" }],
}),
).toEqual({ kind: "splash" });
});
it("shows welcome after root startup gives up waiting for a saved offline host", () => {
it("keeps a known connecting host in app-owned routing instead of showing welcome", () => {
expect(
resolveStartupRoute({
...baseIndexInput,
hosts: [{ serverId: "server-saved" }],
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", () => {
@@ -183,11 +183,9 @@ function resolveReadyIndexStartupRoute(input: ResolveIndexStartupRouteInput): St
return { kind: "redirect", href: buildHostRootRoute(input.anyOnlineHostServerId) };
}
if (workspaceSelection) {
const fallbackServerId = input.hosts[0]?.serverId ?? null;
if (fallbackServerId) {
return { kind: "redirect", href: buildHostRootRoute(fallbackServerId) };
}
const savedHostServerId = input.hosts[0]?.serverId ?? null;
if (savedHostServerId) {
return { kind: "redirect", href: buildHostRootRoute(savedHostServerId) };
}
if (input.hasGivenUpWaitingForHost) {