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
1 change: 1 addition & 0 deletions src/components/benchmark-body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
// 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 531 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 {
Expand Down Expand Up @@ -770,6 +770,7 @@
? chartRegion
: undefined
}
chain={effectiveChain ?? undefined}
excluded={excluded}
onToggleExclude={toggleExclude}
onResetExcluded={resetExcluded}
Expand Down
10 changes: 9 additions & 1 deletion src/components/time-series-chart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ type Props = {
* filters its lines by this value and hides its internal region tabs
* (the parent component renders them in a shared dimension row). */
region?: string;
/** Optional externally-controlled chain. Forwarded to `/api/series` on
* the lazy 7d/30d fetch so the returned sparklines are scoped to the
* same chain the page is currently filtering by. Without this, changing
* the chain tab kept the 7d/30d chart on the previously loaded chain's
* data because the fetch URL had no chain param. */
chain?: string;
/** Optional controlled exclusion set shared with the other chart views
* (ranked-bar, distribution, donut). Lets the reader hide a dominant
* outlier here too — Y-axis re-zooms smoothly to fit the rest. */
Expand Down Expand Up @@ -80,6 +86,7 @@ type Props = {
export function TimeSeriesChart({
benchmark,
region: regionProp,
chain: chainProp,
excluded: controlledExcluded,
onToggleExclude,
seriesOverride,
Expand Down Expand Up @@ -157,6 +164,7 @@ export function TimeSeriesChart({
const buildQs = (range: "7d" | "30d") => {
const qs = new URLSearchParams({ range });
if (regionProp && regionProp !== "all") qs.set("region", regionProp);
if (chainProp && chainProp !== "all") qs.set("chain", chainProp);
return qs.toString();
};
const fetchOne = (range: "7d" | "30d", attempt = 0) => {
Expand Down Expand Up @@ -191,7 +199,7 @@ export function TimeSeriesChart({
return () => {
cancelled = true;
};
}, [regionProp, benchmark.slug]);
}, [regionProp, chainProp, benchmark.slug]);

// Tab availability: 24h is always present (served from the cached
// Benchmark), 7d / 30d are always offered as tabs since they're
Expand Down
Loading