Skip to content

fix: 7d/30d tabs disabled when metric panel is active — lazy-fetch panel long-range series - #1426

Merged
Flotapponnier merged 1 commit into
devfrom
fix/panel-longrange-lazy-fetch
Jul 25, 2026
Merged

fix: 7d/30d tabs disabled when metric panel is active — lazy-fetch panel long-range series#1426
Flotapponnier merged 1 commit into
devfrom
fix/panel-longrange-lazy-fetch

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Problem

On every bench with metric panels (columns like "Volume routed" on `hyperliquid-frontends`), clicking a panel disables the 7d and 30d time-range pills — hover shows "Switch off the metric panel to see long-range history" even though the underlying Prom data exists.

Root cause

  1. Worker computes panel-level `seriesByProvider7d/30d` correctly (materialize/load.ts:980-997)
  2. `slimBenchmarkForCache()` strips those from the cached bench payload to stay under `unstable_cache`'s 2 MB limit
  3. Chart's lazy-fetch of `/api/series/[slug]?range=7d|30d` returns ONLY bench-level series, no panel scope
  4. Chart guard `has30d = !panelActive || !!seriesOverride30d` evaluates false → tab disabled

Fix

A) `/api/series/[slug]?panel=` — new optional param that returns panel-specific series from the same blob/materialized snapshot (already contains them). Cache key bumped to v5.

B) `time-series-chart/index.tsx` — new prop `activePanelId`, dedicated `useEffect` fetches panel 7d/30d when active. Result cached per panel id so switching between panels is instant. `has7d`/`has30d` and `pickPanel()` extended to use lazy panel maps.

C) `benchmark-body.tsx` — passes `activePanelId={activePanel?.id ?? null}` to the chart.

No cache-size impact (long-range series still stripped). CDN cache handles panel fan-out same as bench-level (60s s-maxage + 300s SWR).

Test plan

  • /benchmarks/hyperliquid-frontends → click "Volume routed" panel → 7d + 30d pills enabled and load real data
  • Same on other panel-bearing benches (perp-fees, pm-*, etc.)
  • Deactivate panel → tabs still work with bench-level data
  • Switch back and forth between two panels → both cached, no re-fetch

@Flotapponnier
Flotapponnier merged commit 334298d into dev Jul 25, 2026
1 check failed
@Flotapponnier
Flotapponnier deleted the fix/panel-longrange-lazy-fetch branch July 25, 2026 17:58
Flotapponnier added a commit that referenced this pull request Jul 25, 2026
…ries?panel=<id> (#1426) (#1427)

Co-authored-by: Florent Tapponnier <contact@mobula.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant