: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(inbox): explain when filters hide every report (#88713)
posthog[bot]4ff66bf81397
diff --git a/products/desktop/packages/ui/src/features/inbox/components/InboxReportListTab.test.tsx b/products/desktop/packages/ui/src/features/inbox/components/InboxReportListTab.test.tsxnew file mode 100644index 000000000000..f88b812e0f33--- /dev/null+++ b/products/desktop/packages/ui/src/features/inbox/components/InboxReportListTab.test.tsx@@ -0,0 +1,117 @@+import { ReadCvLogoIcon } from "@phosphor-icons/react";+import type { SignalReport } from "@posthog/shared/types";+import { render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { beforeEach, describe, expect, it, vi } from "vitest";++const mocks = vi.hoisted(() => ({+ reports: [] as SignalReport[],+ hasNextPage: false,+}));++vi.mock("@posthog/ui/features/inbox/hooks/useInboxAllReports", () => ({+ useInboxAllReports: () => ({+ scopedReports: mocks.reports,+ allReports: mocks.reports,+ isLoading: false,+ hasNextPage: mocks.hasNextPage,+ isFetchingNextPage: false,+ fetchNextPage: vi.fn(),+ }),+}));++// The filter bar owns its own data hooks; the empty state is what we assert on.+vi.mock("@posthog/ui/features/inbox/components/InboxSearchFilterBar", () => ({+ InboxSearchFilterBar: () => null,+}));++vi.mock("@posthog/ui/features/inbox/hooks/useInboxBulkActions", () => ({+ buildSuppressDisabledReasonMap: () => new Map(),+ useInboxBulkActions: () => ({+ snoozeSelected: vi.fn(),+ suppressSelected: vi.fn(),+ isSuppressing: false,+ isSnoozing: false,+ snoozeDisabledReason: null,+ }),+}));++vi.mock("@posthog/ui/features/inbox/hooks/useInboxReportListSelection", () => ({+ useInboxReportListSelection: () => ({+ orderedSelectedIds: [],+ selectedCount: 0,+ isReportSelected: () => false,+ handleReportClick: vi.fn(),+ clearSelection: vi.fn(),+ }),+}));++import { InboxReportListTab } from "@posthog/ui/features/inbox/components/InboxReportListTab";+import { useInboxSignalsFilterStore } from "@posthog/ui/features/inbox/stores/inboxSignalsFilterStore";++const emptyState = {+ Icon: ReadCvLogoIcon,+ forYouTitle: "No reports for you yet",+ entireProjectTitle: "No reports in the project yet",+ teammateTitle: "No reports for this reviewer yet",+ description: "Reports are what agents surface.",+ noun: "reports",+};++function renderTab() {+ render(+ <InboxReportListTab+ predicate={() => true}+ Card={() => null}+ searchPlaceholder="Search reports…"+ emptyState={emptyState}+ />,+ );+}++describe("InboxReportListTab", () => {+ beforeEach(() => {+ mocks.reports = [];+ mocks.hasNextPage = false;+ useInboxSignalsFilterStore.setState({+ searchQuery: "",+ sourceProductFilter: [],+ priorityFilter: [],+ prFilter: "all",+ });+ });++ it("shows the genuine-empty copy when no filter is active", () => {+ renderTab();++ expect(screen.getByText("No reports for you yet")).toBeInTheDocument();+ expect(+ screen.queryByRole("button", { name: "Clear filters" }),+ ).not.toBeInTheDocument();+ });++ it("keeps the genuine-empty copy when only a PR filter is set, since this shell ignores it", () => {+ useInboxSignalsFilterStore.getState().setPrFilter("with_pr");+ renderTab();++ expect(screen.getByText("No reports for you yet")).toBeInTheDocument();+ expect(+ screen.queryByRole("button", { name: "Clear filters" }),+ ).not.toBeInTheDocument();+ });++ it("names filters as the cause and clears them on click", async () => {+ useInboxSignalsFilterStore.getState().setPriorityFilter(["P0"]);+ renderTab();++ expect(+ screen.getByText("No reports match your filters"),+ ).toBeInTheDocument();++ await userEvent.click(+ screen.getByRole("button", { name: "Clear filters" }),+ );++ expect(useInboxSignalsFilterStore.getState().priorityFilter).toEqual([]);+ });+});diff --git a/products/desktop/packages/ui/src/features/inbox/components/InboxReportListTab.tsx b/products/desktop/packages/ui/src/features/inbox/components/InboxReportListTab.tsxindex 74dde9ac36fd..3787863bac71 100644--- a/products/desktop/packages/ui/src/features/inbox/components/InboxReportListTab.tsx+++ b/products/desktop/packages/ui/src/features/inbox/components/InboxReportListTab.tsx@@ -1,10 +1,12 @@-import type { IconProps } from "@phosphor-icons/react";+import { FunnelIcon, type IconProps } from "@phosphor-icons/react";import {INBOX_SCOPE_ENTIRE_PROJECT,INBOX_SCOPE_FOR_YOU,} from "@posthog/core/inbox/reportMembership";import {+ Button,Empty,+ EmptyContent,EmptyDescription,EmptyHeader,EmptyMedia,@@ -27,6 +29,10 @@ import {} from "@posthog/ui/features/inbox/hooks/useInboxBulkActions";import { useInboxReportListSelection } from "@posthog/ui/features/inbox/hooks/useInboxReportListSelection";import { useInboxReviewerScopeStore } from "@posthog/ui/features/inbox/stores/inboxReviewerScopeStore";+import {+ hasActiveInboxFilters,+ useInboxSignalsFilterStore,+} from "@posthog/ui/features/inbox/stores/inboxSignalsFilterStore";import {type ComponentType,Fragment,@@ -55,6 +61,8 @@ export interface InboxReportListTabEmptyState {/** Title shown when the scope is a specific teammate. */teammateTitle: string;description: string;+ /** Plural noun for this tab's items, used in the filtered-empty message. */+ noun: string;}interface InboxReportListTabProps {@@ -163,6 +171,13 @@ export function InboxReportListTab({dismissReport != null &&(dismissBulkActions.isSuppressing || dismissBulkActions.isSnoozing);+ // This shell never applies or shows the PR filter, so a stored PR filter must+ // not make its empty state claim filters are hiding results.+ const hasActiveFilters = useInboxSignalsFilterStore((state) =>+ hasActiveInboxFilters(state, { includePrFilter: false }),+ );+ const resetFilters = useInboxSignalsFilterStore((s) => s.resetFilters);+const emptyTitle = resolveEmptyTitle(scope, emptyState);const EmptyIcon = emptyState.Icon;@@ -197,11 +212,34 @@ export function InboxReportListTab({<Empty className="mx-auto max-w-md py-16"><EmptyHeader><EmptyMedia variant="icon">- <EmptyIcon size={24} />+ {hasActiveFilters ? (+ <FunnelIcon size={24} />+ ) : (+ <EmptyIcon size={24} />+ )}</EmptyMedia>- <EmptyTitle>{emptyTitle}</EmptyTitle>- <EmptyDescription>{emptyState.description}</EmptyDescription>+ <EmptyTitle>+ {hasActiveFilters+ ? `No ${emptyState.noun} match your filters`+ : emptyTitle}+ </EmptyTitle>+ <EmptyDescription>+ {hasActiveFilters+ ? `Clear the filters to check for hidden ${emptyState.noun}.`+ : emptyState.description}+ </EmptyDescription></EmptyHeader>+ {hasActiveFilters && (+ <EmptyContent>+ <Button+ variant="outline"+ size="default"+ onClick={() => resetFilters()}+ >+ Clear filters+ </Button>+ </EmptyContent>+ )}</Empty>) : (<>diff --git a/products/desktop/packages/ui/src/features/inbox/components/PullRequestsTab.tsx b/products/desktop/packages/ui/src/features/inbox/components/PullRequestsTab.tsxindex 1d33402ca507..f528643b2758 100644--- a/products/desktop/packages/ui/src/features/inbox/components/PullRequestsTab.tsx+++ b/products/desktop/packages/ui/src/features/inbox/components/PullRequestsTab.tsx@@ -25,6 +25,7 @@ export function PullRequestsTab() {teammateTitle: "No pull requests for this reviewer right now",description:"When an agent ships a code change, the PR draft lands here for you to review and publish.",+ noun: "pull requests",}}/>);diff --git a/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.tsx b/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.tsxindex 87291c01c01c..a688f568a453 100644--- a/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.tsx+++ b/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.tsx@@ -3,6 +3,7 @@ import {CaretDownIcon,CheckCircleIcon,EnvelopeSimpleIcon,+ FunnelIcon,GitMergeIcon,GitPullRequestIcon,ListChecksIcon,@@ -21,6 +22,7 @@ import {import {Button,Empty,+ EmptyContent,EmptyDescription,EmptyHeader,EmptyMedia,@@ -43,7 +45,10 @@ import { useInboxAllReports } from "@posthog/ui/features/inbox/hooks/useInboxAllimport { useInboxReportDismissAction } from "@posthog/ui/features/inbox/hooks/useInboxReportDismissAction";import { useInboxReportsInfinite } from "@posthog/ui/features/inbox/hooks/useInboxReports";import { useInboxSectionCounts } from "@posthog/ui/features/inbox/hooks/useInboxSectionCounts";-import { useInboxSignalsFilterStore } from "@posthog/ui/features/inbox/stores/inboxSignalsFilterStore";+import {+ hasActiveInboxFilters,+ useInboxSignalsFilterStore,+} from "@posthog/ui/features/inbox/stores/inboxSignalsFilterStore";import {PageHeader,PageHeaderActions,@@ -113,6 +118,8 @@ export function ReportsInboxView() {// searching page counts its matching rows instead.const serverCounts = useInboxSectionCounts();const prFilter = useInboxSignalsFilterStore((s) => s.prFilter);+ const hasActiveFilters = useInboxSignalsFilterStore(hasActiveInboxFilters);+ const resetFilters = useInboxSignalsFilterStore((s) => s.resetFilters);const searchActive = searchQuery.trim().length > 0;const decisionCount = searchActive? sections.decision.length@@ -262,14 +269,34 @@ export function ReportsInboxView() {<Empty className="mx-auto max-w-md py-16"><EmptyHeader><EmptyMedia variant="icon">- <EnvelopeSimpleIcon size={24} />+ {hasActiveFilters ? (+ <FunnelIcon size={24} />+ ) : (+ <EnvelopeSimpleIcon size={24} />+ )}</EmptyMedia>- <EmptyTitle>Nothing to review</EmptyTitle>+ <EmptyTitle>+ {hasActiveFilters+ ? "No reports match your filters"+ : "Nothing to review"}+ </EmptyTitle><EmptyDescription>- Reports show up here as your agents find things worth- acting on.+ {hasActiveFilters+ ? "Clear the filters to check for hidden reports."+ : "Reports show up here as your agents find things worth acting on."}</EmptyDescription></EmptyHeader>+ {hasActiveFilters && (+ <EmptyContent>+ <Button+ variant="outline"+ size="default"+ onClick={() => resetFilters()}+ >+ Clear filters+ </Button>+ </EmptyContent>+ )}</Empty>) : (<>diff --git a/products/desktop/packages/ui/src/features/inbox/components/ReportsTab.tsx b/products/desktop/packages/ui/src/features/inbox/components/ReportsTab.tsxindex c33746e8a32f..b83bf3bd407d 100644--- a/products/desktop/packages/ui/src/features/inbox/components/ReportsTab.tsx+++ b/products/desktop/packages/ui/src/features/inbox/components/ReportsTab.tsx@@ -16,6 +16,7 @@ export function ReportsTab() {teammateTitle: "No reports for this reviewer yet",description:"Reports are what agents surface when there's something worth your judgment but no clean code change to draft.",+ noun: "reports",}}/>);diff --git a/products/desktop/packages/ui/src/features/inbox/stores/inboxSignalsFilterStore.test.ts b/products/desktop/packages/ui/src/features/inbox/stores/inboxSignalsFilterStore.test.tsindex 25bf6a9f828f..2b2a59c5d73c 100644--- a/products/desktop/packages/ui/src/features/inbox/stores/inboxSignalsFilterStore.test.ts+++ b/products/desktop/packages/ui/src/features/inbox/stores/inboxSignalsFilterStore.test.ts@@ -1,5 +1,8 @@import { beforeEach, describe, expect, it } from "vitest";-import { useInboxSignalsFilterStore } from "./inboxSignalsFilterStore";+import {+ hasActiveInboxFilters,+ useInboxSignalsFilterStore,+} from "./inboxSignalsFilterStore";describe("inboxSignalsFilterStore", () => {beforeEach(() => {@@ -10,6 +13,7 @@ describe("inboxSignalsFilterStore", () => {searchQuery: "",sourceProductFilter: [],priorityFilter: [],+ prFilter: "all",});});@@ -142,6 +146,55 @@ describe("inboxSignalsFilterStore", () => {expect(state.sortDirection).toBe("asc");});+ it.each([+ ["no filters", () => {}, false],+ [+ "a search query",+ (s: ReturnType<typeof useInboxSignalsFilterStore.getState>) =>+ s.setSearchQuery("login"),+ true,+ ],+ [+ "a whitespace-only search query",+ (s: ReturnType<typeof useInboxSignalsFilterStore.getState>) =>+ s.setSearchQuery(" "),+ false,+ ],+ [+ "a source filter",+ (s: ReturnType<typeof useInboxSignalsFilterStore.getState>) =>+ s.toggleSourceProduct("github"),+ true,+ ],+ [+ "a priority filter",+ (s: ReturnType<typeof useInboxSignalsFilterStore.getState>) =>+ s.setPriorityFilter(["P0"]),+ true,+ ],+ [+ "a PR filter",+ (s: ReturnType<typeof useInboxSignalsFilterStore.getState>) =>+ s.setPrFilter("with_pr"),+ true,+ ],+ // Sort only reorders the list, so it must not read as an active filter.+ [+ "only a non-default sort",+ (s: ReturnType<typeof useInboxSignalsFilterStore.getState>) =>+ s.setSort("created_at", "asc"),+ false,+ ],+ ] as const)(+ "hasActiveInboxFilters is %s -> %s",+ (_label, apply, expected) => {+ apply(useInboxSignalsFilterStore.getState());+ expect(hasActiveInboxFilters(useInboxSignalsFilterStore.getState())).toBe(+ expected,+ );+ },+ );+it("migrates pre-v2 localStorage by dropping the dead filter slots", () => {localStorage.setItem("inbox-signals-filter-storage",diff --git a/products/desktop/packages/ui/src/features/inbox/stores/inboxSignalsFilterStore.ts b/products/desktop/packages/ui/src/features/inbox/stores/inboxSignalsFilterStore.tsindex 2bdf17e02066..2daca2e1597a 100644--- a/products/desktop/packages/ui/src/features/inbox/stores/inboxSignalsFilterStore.ts+++ b/products/desktop/packages/ui/src/features/inbox/stores/inboxSignalsFilterStore.ts@@ -45,6 +45,28 @@ interface InboxSignalsFilterActions {type InboxSignalsFilterStore = InboxSignalsFilterState &InboxSignalsFilterActions;+/**+ * Whether a filter that can hide reports is active. Sort only reorders the+ * list, so it does not count. This is the single definition of "filtered" used+ * by the empty states and the filter bar.+ *+ * `includePrFilter` defaults to true. Surfaces that neither apply nor expose the+ * PR filter (the legacy Reports and Pull requests tabs) pass false, so a stored+ * PR filter they ignore does not make their empty state read as "filtered".+ */+export function hasActiveInboxFilters(+ state: InboxSignalsFilterState,+ options?: { includePrFilter?: boolean },+): boolean {+ const includePrFilter = options?.includePrFilter ?? true;+ return (+ state.searchQuery.trim().length > 0 ||+ state.sourceProductFilter.length > 0 ||+ state.priorityFilter.length > 0 ||+ (includePrFilter && state.prFilter !== "all")+ );+}+/*** v2 dropped per-status and per-reviewer filter UI; surviving consumers are sort,* search, source-product, and priority. Bumping the persist version drops the