@@ -18,7 +24,7 @@ export function ProjectSwitcher({ activeProjectId }: Props) {
type="button"
className="flex h-8 items-center gap-2 rounded-full border border-[var(--color-border)] bg-[var(--color-surface)] px-3.5 text-sm text-[var(--color-foreground-muted)] transition-colors hover:text-[var(--color-foreground)]"
>
- {activeProject?.name ?? "Select a project"}
+ {activeProjectName ?? "Select a project"}
{projects && projects.length > 0 ? (
diff --git a/client/src/features/workspace/graph/WorkspaceGraphView.tsx b/client/src/features/workspace/graph/WorkspaceGraphView.tsx
index 8b39fdb..333a099 100644
--- a/client/src/features/workspace/graph/WorkspaceGraphView.tsx
+++ b/client/src/features/workspace/graph/WorkspaceGraphView.tsx
@@ -57,7 +57,17 @@ export function WorkspaceGraphView({ projectId }: Props) {
{project.data?.name}
-
+ {/*
+ * `h-full` on GraphEngine's own wrapper can resolve to 0 here: this ancestor's height
+ * comes purely from flex-grow (no explicit CSS height anywhere in the chain up to
+ * WorkspaceShell's `min-h-screen`), and percentage heights are unreliable against that.
+ * `absolute inset-0` sizes against the actual laid-out box of this `relative` parent
+ * instead, which is the same trick used to make anything fill a flex-grown container
+ * reliably (BUG #7 -- the graph silently failed to render for any project with data).
+ */}
+
+
+
);
diff --git a/client/src/lib/api-client.test.ts b/client/src/lib/api-client.test.ts
index 1247ba7..37ca53e 100644
--- a/client/src/lib/api-client.test.ts
+++ b/client/src/lib/api-client.test.ts
@@ -68,6 +68,39 @@ describe("apiRequest", () => {
expect(fetch).toHaveBeenCalledTimes(3);
});
+ it("coalesces concurrent 401s into a single refresh call (BUG #1 regression)", async () => {
+ // Two requests expire at once (e.g. two parallel queries after the access token TTL elapses).
+ // Each hits a 401 independently; without de-duplication, both would call /api/auth/refresh
+ // with the same pre-rotation cookie, and the backend's single-use rotation would treat the
+ // second call as a replay -- revoking the whole session chain and logging the user out.
+ useAuthStore.getState().setSession({ accessToken: "stale-token", user: { id: "u1", email: "a@b.com", displayName: null } });
+ vi.mocked(fetch).mockImplementation((input) => {
+ const url = typeof input === "string" ? input : (input as Request).url;
+ if (url.includes("/api/auth/refresh")) {
+ return Promise.resolve(jsonResponse(200, { success: true, data: { accessToken: "fresh-token" } }));
+ }
+ if (url.includes("/projects/a") || url.includes("/projects/b")) {
+ const alreadyRefreshed = useAuthStore.getState().accessToken === "fresh-token";
+ return Promise.resolve(
+ alreadyRefreshed
+ ? jsonResponse(200, { success: true, data: { ok: true } })
+ : jsonResponse(401, { success: false, error: { message: "Unauthorized", code: "UNAUTHORIZED", correlationId: "c" } }),
+ );
+ }
+ throw new Error(`Unexpected fetch to ${url}`);
+ });
+
+ const [resultA, resultB] = await Promise.all([apiRequest("/projects/a"), apiRequest("/projects/b")]);
+
+ expect(resultA).toEqual({ ok: true });
+ expect(resultB).toEqual({ ok: true });
+ const refreshCalls = vi.mocked(fetch).mock.calls.filter(([input]) => {
+ const url = typeof input === "string" ? input : (input as Request).url;
+ return url.includes("/api/auth/refresh");
+ });
+ expect(refreshCalls).toHaveLength(1);
+ });
+
it("clears the session when the refresh itself fails", async () => {
useAuthStore.getState().setSession({ accessToken: "stale-token", user: { id: "u1", email: "a@b.com", displayName: null } });
vi.mocked(fetch)
diff --git a/client/src/lib/api-client.ts b/client/src/lib/api-client.ts
index d468871..0b74063 100644
--- a/client/src/lib/api-client.ts
+++ b/client/src/lib/api-client.ts
@@ -37,21 +37,40 @@ async function rawRequest