mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-05 03:51:54 +01:00
Handle missing project workspace diff base ref
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
af5f646e51
commit
a2b6687b0a
2 files changed
+20
-2
No files matched your search
@@ -235,4 +235,22 @@ describe("ProjectWorkspaceDetail changes tab", () => {
|
||||
"/projects/paperclip-app/workspaces/workspace-1?tab=changes&diffView=head&baseRef=origin%2Fmain",
|
||||
);
|
||||
});
|
||||
|
||||
it("opens the Changes tab in working-tree mode when no upstream ref is known", async () => {
|
||||
mockProjectsApi.get.mockResolvedValue(project({
|
||||
workspaces: [projectWorkspace({ defaultRef: null, repoRef: null })],
|
||||
primaryWorkspace: projectWorkspace({ defaultRef: null, repoRef: null }),
|
||||
codebase: null,
|
||||
}));
|
||||
|
||||
await render();
|
||||
|
||||
await act(async () => {
|
||||
(container.querySelector('[data-tab-value="changes"]') as HTMLButtonElement).click();
|
||||
});
|
||||
|
||||
expect(mockNavigate).toHaveBeenCalledWith(
|
||||
"/projects/paperclip-app/workspaces/workspace-1?tab=changes&diffView=working-tree",
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -428,11 +428,11 @@ export function ProjectWorkspaceDetail() {
|
||||
const handleTabChange = (tab: ProjectWorkspaceTab) => {
|
||||
const workspacePath = projectWorkspaceUrl(project, routeWorkspaceId);
|
||||
if (tab === "changes") {
|
||||
const baseRef = upstreamBaseRef(workspace);
|
||||
const params = new URLSearchParams({
|
||||
tab: "changes",
|
||||
diffView: "head",
|
||||
diffView: baseRef ? "head" : "working-tree",
|
||||
});
|
||||
const baseRef = upstreamBaseRef(workspace);
|
||||
if (baseRef) params.set("baseRef", baseRef);
|
||||
navigate(`${workspacePath}?${params.toString()}`);
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user