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.

perf(desktop): slow the inbox report poll to 30s (#96348)

Paul D'Ambra4f7e2fbe2567
diff --git a/products/desktop/packages/core/src/inbox/reportFiltering.test.ts b/products/desktop/packages/core/src/inbox/reportFiltering.test.ts
index 28a79ccb93c0..c2d2e2042607 100644
--- a/products/desktop/packages/core/src/inbox/reportFiltering.test.ts
+++ b/products/desktop/packages/core/src/inbox/reportFiltering.test.ts
@@ -8,6 +8,7 @@ import {
filterReportsBySearch,
INBOX_PIPELINE_STATUS_FILTER,
INBOX_PIPELINE_STATUSES,
+ INBOX_REFETCH_INTERVAL_MS,
sortInboxReports,
} from "./reportFiltering";
@@ -19,6 +20,12 @@ describe("inbox pipeline statuses", () => {
});
});
+describe("inbox polling", () => {
+ it("keeps the shared mobile refresh cadence", () => {
+ expect(INBOX_REFETCH_INTERVAL_MS).toBe(3_000);
+ });
+});
+
function makeReport(overrides: Partial<SignalReport> = {}): SignalReport {
return {
id: "1",
diff --git a/products/desktop/packages/core/src/inbox/reportFiltering.ts b/products/desktop/packages/core/src/inbox/reportFiltering.ts
index 4a3b856fe274..dd2b67e4b150 100644
--- a/products/desktop/packages/core/src/inbox/reportFiltering.ts
+++ b/products/desktop/packages/core/src/inbox/reportFiltering.ts
@@ -68,8 +68,8 @@ export const INBOX_ACTIONABLE_ACTIONABILITY_FILTER =
*/
export const INBOX_REPORTS_TAB_STATUS_FILTER = "ready";
-/** Polling interval for inbox queries while the Electron window is focused. */
-export const INBOX_REFETCH_INTERVAL_MS = 3000;
+/** Polling interval for mobile inbox queries. */
+export const INBOX_REFETCH_INTERVAL_MS = 3_000;
function normalizeReviewerId(value: string): string {
return value.trim();
diff --git a/products/desktop/packages/ui/src/features/inbox/hooks/inboxPolling.ts b/products/desktop/packages/ui/src/features/inbox/hooks/inboxPolling.ts
new file mode 100644
index 000000000000..4ad08bbac743
--- /dev/null
+++ b/products/desktop/packages/ui/src/features/inbox/hooks/inboxPolling.ts
@@ -0,0 +1 @@
+export const DESKTOP_INBOX_REFETCH_INTERVAL_MS = 30_000;
diff --git a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.test.tsx b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.test.tsx
index 229e738ba232..12081bb5ccb0 100644
--- a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.test.tsx
+++ b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.test.tsx
@@ -48,6 +48,7 @@ vi.mock("@posthog/ui/features/inbox/stores/inboxSignalsFilterStore", () => ({
}),
}));
+import { DESKTOP_INBOX_REFETCH_INTERVAL_MS } from "./inboxPolling";
import { useInboxAllReports } from "./useInboxAllReports";
function readyReport(index: number): SignalReport {
@@ -151,6 +152,10 @@ describe("useInboxAllReports", () => {
expect(reportsCountParams()?.count_only).toBe(true);
});
+ it("uses a 30-second desktop poll interval", () => {
+ expect(DESKTOP_INBOX_REFETCH_INTERVAL_MS).toBe(30_000);
+ });
+
it("stitches subsequent pages without gaps or duplicate reports", async () => {
const { result } = renderCounts();
diff --git a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.ts b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.ts
index 5d330f591250..d6887b37b29a 100644
--- a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.ts
+++ b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.ts
@@ -6,7 +6,6 @@ import {
filterReportsBySearch,
INBOX_PIPELINE_STATUS_FILTER,
INBOX_PULL_REQUEST_STATUS_FILTER,
- INBOX_REFETCH_INTERVAL_MS,
INBOX_REPORTS_TAB_STATUS_FILTER,
} from "@posthog/core/inbox/reportFiltering";
import {
@@ -15,6 +14,7 @@ import {
} from "@posthog/core/inbox/reportMembership";
import { useOptionalAuthenticatedClient } from "@posthog/ui/features/auth/authClient";
import { useCurrentUser } from "@posthog/ui/features/auth/useCurrentUser";
+import { DESKTOP_INBOX_REFETCH_INTERVAL_MS } from "@posthog/ui/features/inbox/hooks/inboxPolling";
import {
useInboxReports,
useInboxReportsInfinite,
@@ -73,7 +73,7 @@ export function useInboxAllReports(options?: {
const applySearchFilter = options?.applySearchFilter ?? true;
const groupByStatus = options?.groupByStatus ?? true;
const refetchIntervalMs =
- options?.refetchIntervalMs ?? INBOX_REFETCH_INTERVAL_MS;
+ options?.refetchIntervalMs ?? DESKTOP_INBOX_REFETCH_INTERVAL_MS;
// The Pull requests tab fetches a server-filtered list (reports that have a
// shipped PR) so its list body comes from the same source as its count — a PR
// sitting past the broad list's first page no longer renders an empty tab
diff --git a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxDismissedReports.ts b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxDismissedReports.ts
index 59e92cd3e2eb..1f25a420b8cd 100644
--- a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxDismissedReports.ts
+++ b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxDismissedReports.ts
@@ -1,8 +1,8 @@
import {
buildArchiveListOrdering,
INBOX_DISMISSED_STATUS_FILTER,
- INBOX_REFETCH_INTERVAL_MS,
} from "@posthog/core/inbox/reportFiltering";
+import { DESKTOP_INBOX_REFETCH_INTERVAL_MS } from "@posthog/ui/features/inbox/hooks/inboxPolling";
import { useInboxReportsInfinite } from "@posthog/ui/features/inbox/hooks/useInboxReports";
/**
@@ -22,7 +22,7 @@ export function useInboxDismissedReports() {
status: INBOX_DISMISSED_STATUS_FILTER,
ordering: buildArchiveListOrdering("updated_at", "desc"),
},
- { refetchInterval: INBOX_REFETCH_INTERVAL_MS },
+ { refetchInterval: DESKTOP_INBOX_REFETCH_INTERVAL_MS },
);
return {