Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

fix(ui): keep commit filters visible on empty results (#2487)

Ayush Dubey3b8e3649e4bd
diff --git a/packages/ui/__tests__/commits/commit-table.test.tsx b/packages/ui/__tests__/commits/commit-table.test.tsx
new file mode 100644
index 000000000..99aacdd0c
--- /dev/null
+++ b/packages/ui/__tests__/commits/commit-table.test.tsx
@@ -0,0 +1,30 @@
+import { render, screen } from "@testing-library/react";
+import { describe, expect, it } from "vitest";
+import type { Commit } from "@repowise-dev/types/git";
+import { CommitTable } from "../../src/commits/commit-table";
+
+const emptyCommitFeed: Commit[] = [];
+
+describe("commit table empty states", () => {
+ it("explains when the unfiltered repository has no indexed commits", () => {
+ render(<CommitTable commits={emptyCommitFeed} sort="date" kind="all" />);
+
+ expect(screen.getByText("No commits indexed")).toBeInTheDocument();
+ });
+
+ it("keeps the filter chips visible when an active filter has no matches", () => {
+ render(
+ <CommitTable
+ commits={emptyCommitFeed}
+ sort="date"
+ kind="high"
+ onKindChange={() => undefined}
+ />,
+ );
+
+ expect(screen.getByText("No matches")).toBeInTheDocument();
+ expect(screen.queryByText("No commits indexed")).not.toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "All" })).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "High priority" })).toBeInTheDocument();
+ });
+});
diff --git a/packages/ui/src/commits/commit-table.tsx b/packages/ui/src/commits/commit-table.tsx
index 2979dccef..11d155efa 100644
--- a/packages/ui/src/commits/commit-table.tsx
+++ b/packages/ui/src/commits/commit-table.tsx
@@ -172,7 +172,7 @@ export function CommitTable({
);
}, [commits, search]);
- if (commits.length === 0 && authorship === "all") {
+ if (commits.length === 0 && authorship === "all" && kind === "all") {
return (
<EmptyState
title="No commits indexed"