mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-05-16 01:12:46 +00:00
fix: workspace navigation path from /workspace to /workspaces
This commit is contained in:
@@ -23,8 +23,7 @@ import {
|
|||||||
splitWorkspacesByStarred,
|
splitWorkspacesByStarred,
|
||||||
} from '@/components/refactored/sidebar/utils/workspaceTransforms';
|
} from '@/components/refactored/sidebar/utils/workspaceTransforms';
|
||||||
|
|
||||||
const SESSION_ROUTE_PATTERN = /^\/session\/([^/]+)$/;
|
const SESSION_ROUTE_PATTERN = /^\/workspaces\/[^/]+\/sessions\/([^/]+)(?:\/[^/]+)?$/;
|
||||||
const LEGACY_SESSION_ROUTE_PATTERN = /^\/sessions\/([^/]+)$/;
|
|
||||||
|
|
||||||
const extractSessionIdFromPathname = (pathname: string): string | null => {
|
const extractSessionIdFromPathname = (pathname: string): string | null => {
|
||||||
const sessionMatch = pathname.match(SESSION_ROUTE_PATTERN);
|
const sessionMatch = pathname.match(SESSION_ROUTE_PATTERN);
|
||||||
@@ -32,11 +31,6 @@ const extractSessionIdFromPathname = (pathname: string): string | null => {
|
|||||||
return decodeURIComponent(sessionMatch[1]);
|
return decodeURIComponent(sessionMatch[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const legacySessionMatch = pathname.match(LEGACY_SESSION_ROUTE_PATTERN);
|
|
||||||
if (legacySessionMatch?.[1]) {
|
|
||||||
return decodeURIComponent(legacySessionMatch[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -116,9 +110,20 @@ export const useWorkspaces = () => {
|
|||||||
nextSet.add(workspacePath);
|
nextSet.add(workspacePath);
|
||||||
return nextSet;
|
return nextSet;
|
||||||
});
|
});
|
||||||
navigate(`/session/${encodeURIComponent(sessionId)}`);
|
|
||||||
|
const matchedWorkspace = workspaces.find(
|
||||||
|
(workspace) => workspace.workspaceOriginalPath === workspacePath,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!matchedWorkspace) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
navigate(
|
||||||
|
`/workspaces/${encodeURIComponent(matchedWorkspace.workspaceId)}/sessions/${encodeURIComponent(sessionId)}`,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
[navigate],
|
[navigate, workspaces],
|
||||||
);
|
);
|
||||||
|
|
||||||
const openNewSession = useCallback(() => {
|
const openNewSession = useCallback(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user