Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(dashboards): allow shorter dashboard refresh intervals (#105519)

Matt Pua8f32b81040bb
diff --git a/frontend/src/scenes/dashboard/DashboardReloadAction.tsx b/frontend/src/scenes/dashboard/DashboardReloadAction.tsx
index 16ca49b777b8..bd2a85bb14ae 100644
--- a/frontend/src/scenes/dashboard/DashboardReloadAction.tsx
+++ b/frontend/src/scenes/dashboard/DashboardReloadAction.tsx
@@ -56,7 +56,7 @@ export function DashboardRefreshStatusText(): JSX.Element {
)
}
-const REFRESH_INTERVAL_SECONDS = [1800, 3600]
+const REFRESH_INTERVAL_SECONDS = [900, 1800, 3600]
if (process.env.NODE_ENV === 'development') {
REFRESH_INTERVAL_SECONDS.unshift(10)
}
diff --git a/frontend/src/scenes/dashboard/dashboardLogic.test.ts b/frontend/src/scenes/dashboard/dashboardLogic.test.ts
index 657b63b65ae9..2ff231177fa5 100644
--- a/frontend/src/scenes/dashboard/dashboardLogic.test.ts
+++ b/frontend/src/scenes/dashboard/dashboardLogic.test.ts
@@ -2671,6 +2671,17 @@ describe('dashboardLogic', () => {
})
describe('insight refresh', () => {
+ it('allows another manual dashboard refresh after five minutes', () => {
+ const recentRefresh = now().subtract(4, 'minutes')
+ logic.actions.updateDashboardLastRefresh(recentRefresh)
+ expect(logic.values.blockRefresh).toBe(true)
+
+ const lastRefresh = now().subtract(6, 'minutes')
+ logic.actions.updateDashboardLastRefresh(lastRefresh)
+ expect(logic.values.nextAllowedDashboardRefresh?.isSame(lastRefresh.add(5, 'minutes'))).toBe(true)
+ expect(logic.values.blockRefresh).toBe(false)
+ })
+
it('manual refresh reloads all insights', async () => {
const dashboard = dashboards[5]
const insight1 = dashboard.tiles[0].insight!
@@ -3057,11 +3068,11 @@ describe('dashboardLogic', () => {
describe('page visibility', () => {
it('pauses auto-refresh when page is hidden and resumes when visible', async () => {
await expectLogic(logic, () => {
- logic.actions.setAutoRefresh(true, 1800)
+ logic.actions.setAutoRefresh(true, 900)
})
.toDispatchActions(['setAutoRefresh', 'resetInterval'])
.toMatchValues({
- autoRefresh: { enabled: true, interval: 1800 },
+ autoRefresh: { enabled: true, interval: 900 },
})
await expectLogic(logic, () => {
diff --git a/frontend/src/scenes/dashboard/dashboardUtils.ts b/frontend/src/scenes/dashboard/dashboardUtils.ts
index 302e90ac6cec..8f36c196f38d 100644
--- a/frontend/src/scenes/dashboard/dashboardUtils.ts
+++ b/frontend/src/scenes/dashboard/dashboardUtils.ts
@@ -171,7 +171,7 @@ export const BREAKPOINT_COLUMN_COUNTS: Record<DashboardLayoutSize, number> = { s
* The minimum interval between manual dashboard refreshes.
* This is used to block the dashboard refresh button.
*/
-export const DASHBOARD_MIN_REFRESH_INTERVAL_MINUTES = 15
+export const DASHBOARD_MIN_REFRESH_INTERVAL_MINUTES = 5
export const IS_TEST_MODE = process.env.NODE_ENV === 'test'