-
+ b.category)))}
+ />
);
}
diff --git a/src/components/benchmark-grid.tsx b/src/components/benchmark-grid.tsx
index e9bee30b..cf055535 100644
--- a/src/components/benchmark-grid.tsx
+++ b/src/components/benchmark-grid.tsx
@@ -28,12 +28,17 @@ import { categorySlugFromLabel } from "@/lib/categories";
export function BenchmarkGrid({
benchmarks,
lockedCategory = null,
+ allCategories,
}: {
benchmarks: Benchmark[];
- /** When set, force the grid to this category and hide the filter pills.
- * Used by the per-category hub routes so the rendered DOM matches the
- * URL and the in-page filter UI doesn't conflict with the route. */
+ /** When set, force the grid to this category. The pill row still
+ * renders so users can jump to other category hubs via the same UI
+ * they had on the /benchmarks root. */
lockedCategory?: string | null;
+ /** Full category list to show in the pills, used by the category hub
+ * routes where the `benchmarks` prop is pre-filtered to a single
+ * category. If unset, the grid derives pills from `benchmarks`. */
+ allCategories?: string[];
}) {
const [query, setQuery] = useState("");
const [activeCategory, setActiveCategory] = useState(
@@ -43,6 +48,7 @@ export function BenchmarkGrid({
const q = query.trim().toLowerCase();
const categories = useMemo(() => {
+ if (allCategories && allCategories.length > 0) return allCategories;
const seen = new Set();
const list: string[] = [];
for (const b of benchmarks) {
@@ -52,7 +58,7 @@ export function BenchmarkGrid({
}
}
return list;
- }, [benchmarks]);
+ }, [benchmarks, allCategories]);
const filtered = useMemo(() => {
return benchmarks.filter((b) => {
@@ -71,48 +77,52 @@ export function BenchmarkGrid({
});
}, [benchmarks, q, activeCategory]);
- const showFilterPills = !lockedCategory;
-
+ // Pills always render. When the grid is locked to a category route,
+ // pill clicks navigate (no preventDefault) so the user moves between
+ // /benchmarks/category/ URLs. On the unlocked /benchmarks page
+ // they filter in place for a snappier UX without a navigation
+ // roundtrip.
return (