fix(app): restore mobile reconnect welcome
This commit is contained in:
@@ -259,12 +259,13 @@ describe("resolveStartupRoute", () => {
|
|||||||
).toEqual({ kind: "redirect", href: "/h/server-1/workspace/workspace-a" });
|
).toEqual({ kind: "redirect", href: "/h/server-1/workspace/workspace-a" });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not restore a workspace whose host is no longer saved", () => {
|
it("falls back to a saved host when the restored workspace host is no longer saved", () => {
|
||||||
expect(
|
expect(
|
||||||
resolveStartupRoute({
|
resolveStartupRoute({
|
||||||
...baseIndexInput,
|
...baseIndexInput,
|
||||||
workspaceSelection: { serverId: "server-saved", workspaceId: "workspace-a" },
|
workspaceSelection: { serverId: "server-saved", workspaceId: "workspace-a" },
|
||||||
hosts: [{ serverId: "server-next" }],
|
hosts: [{ serverId: "server-next" }],
|
||||||
|
hasGivenUpWaitingForHost: true,
|
||||||
}),
|
}),
|
||||||
).toEqual({ kind: "redirect", href: "/h/server-next" });
|
).toEqual({ kind: "redirect", href: "/h/server-next" });
|
||||||
});
|
});
|
||||||
@@ -278,17 +279,26 @@ describe("resolveStartupRoute", () => {
|
|||||||
).toEqual({ kind: "redirect", href: "/h/srv-desktop" });
|
).toEqual({ kind: "redirect", href: "/h/srv-desktop" });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("keeps a known connecting host in app-owned routing instead of showing welcome", () => {
|
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", () => {
|
||||||
expect(
|
expect(
|
||||||
resolveStartupRoute({
|
resolveStartupRoute({
|
||||||
...baseIndexInput,
|
...baseIndexInput,
|
||||||
hosts: [{ serverId: "server-saved" }],
|
hosts: [{ serverId: "server-saved" }],
|
||||||
hasGivenUpWaitingForHost: true,
|
hasGivenUpWaitingForHost: true,
|
||||||
}),
|
}),
|
||||||
).toEqual({ kind: "redirect", href: "/h/server-saved" });
|
).toEqual({ kind: "redirect", href: "/welcome" });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("shows welcome only after the host registry is ready and no host exists", () => {
|
it("shows welcome after root startup gives up and no host exists", () => {
|
||||||
expect(
|
expect(
|
||||||
resolveStartupRoute({
|
resolveStartupRoute({
|
||||||
...baseIndexInput,
|
...baseIndexInput,
|
||||||
|
|||||||
@@ -183,9 +183,11 @@ function resolveReadyIndexStartupRoute(input: ResolveIndexStartupRouteInput): St
|
|||||||
return { kind: "redirect", href: buildHostRootRoute(input.anyOnlineHostServerId) };
|
return { kind: "redirect", href: buildHostRootRoute(input.anyOnlineHostServerId) };
|
||||||
}
|
}
|
||||||
|
|
||||||
const savedHostServerId = input.hosts[0]?.serverId ?? null;
|
if (workspaceSelection) {
|
||||||
if (savedHostServerId) {
|
const fallbackServerId = input.hosts[0]?.serverId ?? null;
|
||||||
return { kind: "redirect", href: buildHostRootRoute(savedHostServerId) };
|
if (fallbackServerId) {
|
||||||
|
return { kind: "redirect", href: buildHostRootRoute(fallbackServerId) };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input.hasGivenUpWaitingForHost) {
|
if (input.hasGivenUpWaitingForHost) {
|
||||||
|
|||||||
Reference in New Issue
Block a user