Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion webui/src/components/code/commit-list.interaction.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function renderList(
// type policy Apollo cannot resolve the entity across pages, and re-issues
// the first query after every fetchMore.
<MockedProvider mocks={mocks} showWarnings={false} cache={new InMemoryCache({ typePolicies })}>
<CommitList repo={props.repo ?? "myrepo"} ref_={props.ref_ ?? "main"} path={props.path} />
<CommitList repo={props.repo ?? null} ref_={props.ref_ ?? "main"} path={props.path} />
</MockedProvider>,
);
}
Expand Down Expand Up @@ -133,6 +133,12 @@ describe("CommitList — commits", () => {
renderList({}, [mock]);
await waitFor(() => expect(screen.getByText("h1")).toBeInTheDocument());
});

it("renders valid commit link with null repo", async () => {
const { mock } = makeQueryMock([makeCommit(1)], false, null);
renderList({ repo: null, ref_: "main"}, [mock]);
await waitFor(() => expect(screen.getByText("Commit message 1")).toHaveAttribute("href", "/_/commit/hash1"));
});
});

// ── Pagination ────────────────────────────────────────────────────────────────
Expand Down
2 changes: 1 addition & 1 deletion webui/src/components/code/commit-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export function CommitList({ repo, ref_, path }: CommitListProps) {
}

function CommitRow({ commit, repo }: { commit: CommitNode; repo: string | null }) {
const commitPath = repo ? `/${repo}/commit/${commit.hash}` : `/commit/${commit.hash}`;
const commitPath = `/${repo ?? "_"}/commit/${commit.hash}`;
return (
<div className="bg-background hover:bg-muted/30 flex items-center gap-3 px-4 py-3">
<GitCommit className="text-muted-foreground size-4 shrink-0" />
Expand Down
Loading