Skip to content
Merged
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
34 changes: 33 additions & 1 deletion src/components/benchmark-body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,23 @@
computeFieldStats(viewBenchmark.results);
const activePanel =
benchmark.metricPanels?.find((p) => p.id === activePanelId) ?? null;
// Value views (ranked bars) swap each provider's headline p50 for the
// active panel's scalar so the size tabs work on the default chart,
// not only on the timeseries view. Providers the panel has no value
// for (book could not fill the tier) drop out of the ranking, which
// is the skipped-not-extrapolated rule made visible.
const panelViewBenchmark = useMemo(() => {

Check failure on line 543 in src/components/benchmark-body.tsx

View workflow job for this annotation

GitHub Actions / check

React Hook "useMemo" is called conditionally. React Hooks must be called in the exact same order in every component render. Did you accidentally call a React Hook after an early return?
if (!activePanel) return viewBenchmark;
const vals = activePanel.values ?? {};
return {
...viewBenchmark,
metric: activePanel.label,
unit: activePanel.unit ?? viewBenchmark.unit,
results: viewBenchmark.results
.filter((r) => vals[r.slug] != null && Number.isFinite(vals[r.slug]))
.map((r) => ({ ...r, ms: { ...r.ms, p50: vals[r.slug] } })),
};
}, [viewBenchmark, activePanel]);

return (
<>
Expand Down Expand Up @@ -695,15 +712,30 @@
/>
)}
{view === "rankedBar" && (
<>
{(() => {
const tabPanels = (benchmark.metricPanels ?? []).filter(
(p) => p.tab !== false,
);
return tabPanels.length > 0 ? (
<MetricViewTabs
panels={tabPanels}
mainLabel={benchmark.metric}
activeId={activePanelId}
onSelect={setActivePanelId}
/>
) : null;
})()}
<RankedBarChart
benchmark={viewBenchmark}
benchmark={panelViewBenchmark}
excluded={excluded}
onToggleExclude={toggleExclude}
onResetExcluded={resetExcluded}
disableTopN={hasLayerSplit}
topNControl={topNControl}
headerActions={<ViewSwitcher allowed={allowedViews} value={view} onChange={setView} />}
/>
</>
)}
{view === "distribution" && (
<DistributionChart
Expand Down
Loading