Fix workspace navigation regression on web (#772)
Centralize workspace navigation behind a small route-derived API so the workspace shell reads active selection from the current Expo Router route instead of a separately synchronized store.
Remove the stale layout-driven active-workspace write that regressed web after 02e5b564.
This commit is contained in:
@@ -3,10 +3,6 @@ import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { buildWorkspaceArchiveRedirectRoute } from "@/utils/workspace-archive-navigation";
|
||||
import type { WorkspaceDescriptor } from "@/stores/session-store";
|
||||
import { useSessionStore } from "@/stores/session-store";
|
||||
import {
|
||||
activateNavigationWorkspaceSelection,
|
||||
syncNavigationActiveWorkspace,
|
||||
} from "@/stores/navigation-active-workspace-store";
|
||||
import { redirectIfArchivingActiveWorkspace } from "@/utils/sidebar-workspace-archive-redirect";
|
||||
|
||||
const { replaceMock } = vi.hoisted(() => ({
|
||||
@@ -96,7 +92,6 @@ describe("buildWorkspaceArchiveRedirectRoute", () => {
|
||||
describe("redirectIfArchivingActiveWorkspace", () => {
|
||||
afterEach(() => {
|
||||
replaceMock.mockClear();
|
||||
syncNavigationActiveWorkspace({ current: null });
|
||||
useSessionStore.getState().clearSession("server-1");
|
||||
});
|
||||
|
||||
@@ -109,12 +104,11 @@ describe("redirectIfArchivingActiveWorkspace", () => {
|
||||
["feature", workspace({ id: "feature", name: "feature" })],
|
||||
]),
|
||||
);
|
||||
activateNavigationWorkspaceSelection({ serverId: "server-1", workspaceId: "main" });
|
||||
|
||||
expect(
|
||||
redirectIfArchivingActiveWorkspace({
|
||||
serverId: "server-1",
|
||||
workspaceId: "feature",
|
||||
activeWorkspaceSelection: { serverId: "server-1", workspaceId: "main" },
|
||||
}),
|
||||
).toBe(false);
|
||||
|
||||
@@ -130,12 +124,11 @@ describe("redirectIfArchivingActiveWorkspace", () => {
|
||||
["feature", workspace({ id: "feature", name: "feature" })],
|
||||
]),
|
||||
);
|
||||
activateNavigationWorkspaceSelection({ serverId: "server-1", workspaceId: "feature" });
|
||||
|
||||
expect(
|
||||
redirectIfArchivingActiveWorkspace({
|
||||
serverId: "server-1",
|
||||
workspaceId: "feature",
|
||||
activeWorkspaceSelection: { serverId: "server-1", workspaceId: "feature" },
|
||||
}),
|
||||
).toBe(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user