Skip to content

Commit deb3155

Browse files
committed
Fix workspace metadata lookups in App.tsx and ProjectSidebar
The workspaceMetadata map is keyed by workspace ID, not path. Extract the workspace ID from workspace.path before looking up metadata. This fixes E2E test failures where workspaces weren't appearing.
1 parent 05b3ba5 commit deb3155

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/App.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,11 @@ function AppInner() {
321321
result.set(
322322
projectPath,
323323
config.workspaces.slice().sort((a, b) => {
324-
const aMeta = workspaceMetadata.get(a.path);
325-
const bMeta = workspaceMetadata.get(b.path);
324+
// Extract workspace ID from path
325+
const aId = a.path.replace(/\\/g, "/").split("/").pop() || "";
326+
const bId = b.path.replace(/\\/g, "/").split("/").pop() || "";
327+
const aMeta = workspaceMetadata.get(aId);
328+
const bMeta = workspaceMetadata.get(bId);
326329
if (!aMeta || !bMeta) return 0;
327330

328331
// Get timestamp of most recent user message (0 if never used)
@@ -374,7 +377,9 @@ function AppInner() {
374377
const targetWorkspace = sortedWorkspaces[targetIndex];
375378
if (!targetWorkspace) return;
376379

377-
const metadata = workspaceMetadata.get(targetWorkspace.path);
380+
// Extract workspace ID from path
381+
const workspaceId = targetWorkspace.path.replace(/\\/g, "/").split("/").pop() || "";
382+
const metadata = workspaceMetadata.get(workspaceId);
378383
if (!metadata) return;
379384

380385
setSelectedWorkspace({

src/components/ProjectSidebar.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -823,10 +823,9 @@ const ProjectSidebarInner: React.FC<ProjectSidebarProps> = ({
823823
{(sortedWorkspacesByProject.get(projectPath) ?? config.workspaces).map(
824824
(workspace) => {
825825
// Extract workspace ID from path (path format: ~/.cmux/src/projectName/workspaceId)
826-
const workspaceId =
827-
workspace.path.split("/").pop() ??
828-
workspace.path.split("\\").pop() ??
829-
"";
826+
// Handle both Unix (/) and Windows (\) path separators
827+
const pathParts = workspace.path.replace(/\\/g, "/").split("/");
828+
const workspaceId = pathParts[pathParts.length - 1] || "";
830829
const metadata = workspaceMetadata.get(workspaceId);
831830
if (!metadata) return null;
832831
const isSelected =

0 commit comments

Comments
 (0)