diff --git a/packages/app/src/app/index.test.tsx b/packages/app/src/app/index.test.tsx
index cd6540363..0740675ad 100644
--- a/packages/app/src/app/index.test.tsx
+++ b/packages/app/src/app/index.test.tsx
@@ -8,7 +8,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { HostRuntimeBootstrapState } from "./_layout";
import type { ActiveWorkspaceSelection } from "@/stores/navigation-active-workspace-store";
-const { navigateToWorkspaceMock, redirectMock, state } = vi.hoisted(() => {
+const { redirectMock, state } = vi.hoisted(() => {
const hoistedState = {
pathname: "/",
bootstrapState: {
@@ -23,7 +23,6 @@ const { navigateToWorkspaceMock, redirectMock, state } = vi.hoisted(() => {
};
return {
- navigateToWorkspaceMock: vi.fn(),
redirectMock: vi.fn(),
state: hoistedState,
};
@@ -51,7 +50,6 @@ vi.mock("@/screens/startup-splash-screen", () => ({
}));
vi.mock("@/stores/navigation-active-workspace-store", () => ({
- navigateToWorkspace: navigateToWorkspaceMock,
useIsLastWorkspaceSelectionHydrated: () => state.isWorkspaceSelectionLoaded,
useLastWorkspaceSelection: () => state.workspaceSelection,
}));
@@ -72,7 +70,6 @@ describe("Index route startup navigation", () => {
state.anyOnlineHostServerId = null;
state.isWorkspaceSelectionLoaded = true;
state.workspaceSelection = null;
- navigateToWorkspaceMock.mockReset();
redirectMock.mockReset();
container = document.createElement("div");
@@ -108,7 +105,6 @@ describe("Index route startup navigation", () => {
await renderIndex();
expect(container.querySelector("[data-testid='startup-splash']")).not.toBeNull();
- expect(navigateToWorkspaceMock).not.toHaveBeenCalled();
expect(redirectMock).not.toHaveBeenCalled();
});
@@ -118,11 +114,8 @@ describe("Index route startup navigation", () => {
await renderIndex();
- expect(navigateToWorkspaceMock).toHaveBeenCalledWith("server-1", "workspace-a", {
- currentPathname: "/",
- });
- expect(redirectMock).not.toHaveBeenCalled();
- expect(container.querySelector("[data-testid='startup-splash']")).not.toBeNull();
+ expect(redirectMock).toHaveBeenCalledWith("/h/server-1/workspace/workspace-a");
+ expect(container.querySelector("[data-testid='redirect']")).not.toBeNull();
});
it("restores the persisted workspace even when the first online host is different", async () => {
@@ -131,10 +124,7 @@ describe("Index route startup navigation", () => {
await renderIndex();
- expect(navigateToWorkspaceMock).toHaveBeenCalledWith("server-1", "workspace-a", {
- currentPathname: "/",
- });
- expect(redirectMock).not.toHaveBeenCalled();
+ expect(redirectMock).toHaveBeenCalledWith("/h/server-1/workspace/workspace-a");
});
it("navigates to the host root when no persisted workspace exists", async () => {
diff --git a/packages/app/src/app/index.tsx b/packages/app/src/app/index.tsx
index d2fbbd53d..4156f0a37 100644
--- a/packages/app/src/app/index.tsx
+++ b/packages/app/src/app/index.tsx
@@ -7,11 +7,11 @@ import {
resolveStartupWorkspaceSelection,
} from "@/app/host-runtime-bootstrap";
import {
- navigateToWorkspace,
useIsLastWorkspaceSelectionHydrated,
useLastWorkspaceSelection,
} from "@/stores/navigation-active-workspace-store";
import { shouldUseDesktopDaemon } from "@/desktop/daemon/desktop-daemon";
+import { buildHostWorkspaceRoute } from "@/utils/host-routes";
const isDesktop = shouldUseDesktopDaemon();
@@ -37,17 +37,15 @@ export default function Index() {
hasGivenUpWaitingForHost: bootstrapState.hasGivenUpWaitingForHost,
});
- React.useEffect(() => {
- if (!startupWorkspaceSelection) {
- return;
- }
- navigateToWorkspace(startupWorkspaceSelection.serverId, startupWorkspaceSelection.workspaceId, {
- currentPathname: pathname,
- });
- }, [pathname, startupWorkspaceSelection]);
-
if (startupWorkspaceSelection) {
- return ;
+ return (
+
+ );
}
if (redirectRoute) {