Skip to content

feat(analytics): persisted auto-refresh interval for SQL dashboards#779

Draft
zuchka wants to merge 1 commit into
mainfrom
feat/dashboard-refresh-interval
Draft

feat(analytics): persisted auto-refresh interval for SQL dashboards#779
zuchka wants to merge 1 commit into
mainfrom
feat/dashboard-refresh-interval

Conversation

@zuchka
Copy link
Copy Markdown
Contributor

@zuchka zuchka commented May 20, 2026

Summary

  • Adds refreshInterval?: number to SqlDashboardConfig — stored in the dashboard config, survives page reloads
  • Wires through SqlChartCardSqlChartuseSqlQuery as React Query's refetchInterval
  • Sets staleTime: 0 when refetchInterval is active so every tick fires a real fetch
  • Adds a Refresh Select control to the filter row on every dashboard (Off / 0.5 s / 1 s / 5 s / 10 s / 30 s), saved via the existing persist() path
  • Dashboards without refreshInterval set are completely unaffected (default Off)

Files changed

File Change
app/pages/adhoc/sql-dashboard/types.ts Add refreshInterval?: number to SqlDashboardConfig
app/lib/sql-query.ts staleTime: 0 when refetchInterval is set
app/components/dashboard/SqlChart.tsx Accept + forward refreshInterval to useSqlQuery
app/pages/adhoc/sql-dashboard/SqlChartCard.tsx Accept + forward refreshInterval to SqlChart
app/pages/adhoc/sql-dashboard/index.tsx Read from loaded config, pass to card, render Select control

Test plan

  • Open any dashboard → filter row shows Refresh: Off dropdown
  • Set to 1 s → panels start refetching every second (visible in Network tab)
  • Save and reload page → interval persists at 1 s
  • Set back to Off → polling stops
  • Other dashboards open fresh with Off (no unintended polling)
  • Dashboard seed with "refreshInterval": 1000 auto-sets the dropdown to 1 s on first load

🤖 Generated with Claude Code

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@cloudflare-workers-and-pages

This comment has been minimized.

@cloudflare-workers-and-pages

This comment has been minimized.

@cloudflare-workers-and-pages

This comment has been minimized.

@cloudflare-workers-and-pages

This comment has been minimized.

Adds a `refreshInterval?: number` field to `SqlDashboardConfig` that
wires through to React Query's `refetchInterval` on every panel. A
Select control in the filter row (Off / 0.5 s / 1 s / 5 s / 10 s / 30 s)
lets users set the interval per-dashboard; the value is persisted to the
dashboard config so it survives page reloads.

When `refetchInterval` is active, `staleTime` is set to 0 so React Query
always treats the cache as stale and fires every tick.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@zuchka zuchka force-pushed the feat/dashboard-refresh-interval branch from f54c8ea to e8da298 Compare May 20, 2026 00:11
@cloudflare-workers-and-pages

This comment has been minimized.

@cloudflare-workers-and-pages

This comment has been minimized.

@cloudflare-workers-and-pages

This comment has been minimized.

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