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.

fix(desktop): apply report search to archived results (#89713)

Dylan Martin040beb55dcf3
diff --git a/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.test.tsx b/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.test.tsx
new file mode 100644
index 000000000000..5fc0f08a277f
--- /dev/null
+++ b/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.test.tsx
@@ -0,0 +1,128 @@
+import type { SignalReport } from "@posthog/shared/types";
+import { useInboxSignalsFilterStore } from "@posthog/ui/features/inbox/stores/inboxSignalsFilterStore";
+import { render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+const mocks = vi.hoisted(() => ({
+ archivedReports: [] as SignalReport[],
+ fetchNextPage: vi.fn(),
+ searchQuery: "",
+}));
+
+vi.mock("@posthog/ui/features/feature-flags/useTriageFocusEnabled", () => ({
+ useTriageFocusEnabled: () => false,
+}));
+
+vi.mock("@posthog/ui/features/inbox/hooks/useInboxAllReports", () => ({
+ useInboxAllReports: () => ({
+ scopedReports: [],
+ allReports: [],
+ isLoading: false,
+ hasNextPage: false,
+ isFetchingNextPage: false,
+ fetchNextPage: vi.fn(),
+ searchQuery: mocks.searchQuery,
+ totalCount: 0,
+ scope: "entire_project",
+ isSuccess: true,
+ sourceProductFilter: [],
+ priorityFilter: [],
+ }),
+}));
+
+vi.mock("@posthog/ui/features/inbox/hooks/useInboxReports", () => ({
+ useInboxReportsInfinite: () => ({
+ allReports: mocks.archivedReports,
+ isLoading: false,
+ hasNextPage: true,
+ fetchNextPage: mocks.fetchNextPage,
+ isFetchingNextPage: false,
+ }),
+}));
+
+vi.mock("@posthog/ui/features/inbox/hooks/useInboxSectionCounts", () => ({
+ useInboxSectionCounts: () => ({
+ decision: 0,
+ decisionPr: 0,
+ monitoring: 0,
+ isLoading: false,
+ }),
+}));
+
+vi.mock("@posthog/ui/features/inbox/hooks/useTrackReportsInboxViewed", () => ({
+ useTrackReportsInboxViewed: () => undefined,
+}));
+
+vi.mock("@posthog/ui/features/inbox/hooks/useInboxReportDismissAction", () => ({
+ useInboxReportDismissAction: () => ({
+ actionButton: null,
+ dialog: null,
+ }),
+}));
+
+vi.mock(
+ "@posthog/ui/features/inbox/components/SuggestedReviewerAvatarStack",
+ () => ({ SuggestedReviewerAvatarStack: () => null }),
+);
+
+vi.mock(
+ "@posthog/ui/features/inbox/components/utils/SignalReportPriorityBadge",
+ () => ({ SignalReportPriorityBadge: () => null }),
+);
+
+vi.mock("@posthog/ui/features/inbox/components/ReportRestoreButton", () => ({
+ ReportRestoreButton: () => null,
+}));
+
+vi.mock("@posthog/ui/features/inbox/components/InboxSearchFilterBar", () => ({
+ InboxSearchFilterBar: () => null,
+}));
+
+vi.mock("@posthog/ui/features/inbox/components/InboxScopeSelect", () => ({
+ InboxScopeSelect: () => null,
+}));
+
+import { ReportsInboxView } from "./ReportsInboxView";
+
+function archivedReport(id: string, title: string): SignalReport {
+ return {
+ id,
+ title,
+ summary: null,
+ status: "suppressed",
+ total_weight: 1,
+ signal_count: 1,
+ created_at: "2026-01-01T00:00:00Z",
+ updated_at: "2026-01-01T00:00:00Z",
+ artefact_count: 0,
+ implementation_pr_url: null,
+ };
+}
+
+describe("ReportsInboxView", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ mocks.archivedReports = [
+ archivedReport("matching-report", "Checkout errors"),
+ archivedReport("hidden-report", "Slow dashboards"),
+ ];
+ mocks.searchQuery = "checkout";
+ useInboxSignalsFilterStore.setState({
+ searchQuery: "checkout",
+ sourceProductFilter: [],
+ priorityFilter: [],
+ prFilter: "all",
+ });
+ });
+
+ it("applies report search to the resolved and archived section", async () => {
+ render(<ReportsInboxView />);
+
+ await userEvent.click(screen.getByText("Resolved & archived"));
+
+ expect(screen.getByText("Checkout errors")).toBeInTheDocument();
+ expect(screen.queryByText("Slow dashboards")).not.toBeInTheDocument();
+ await waitFor(() => expect(mocks.fetchNextPage).toHaveBeenCalledOnce());
+ });
+});
diff --git a/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.tsx b/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.tsx
index 56abc873d6f1..8718b9d831b6 100644
--- a/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.tsx
+++ b/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.tsx
@@ -10,6 +10,7 @@ import {
} from "@phosphor-icons/react";
import { humanizeIdentifier } from "@posthog/core/inbox/activityLog";
import {
+ filterReportsBySearch,
INBOX_DISMISSED_STATUS_FILTER,
REPORTS_INBOX_STATUS_FILTER,
} from "@posthog/core/inbox/reportFiltering";
@@ -341,7 +342,7 @@ export function ReportsInboxView() {
)}
</>
)}
- <ResolvedSection />
+ <ResolvedSection searchQuery={searchQuery} />
</>
)}
</div>
@@ -551,7 +552,11 @@ function InboxReportRow({ report }: { report: SignalReport }) {
// Archived and resolved reports come from their own server-side fetch, so the
// section fetches lazily on first expand and stays collapsed by default.
-function ResolvedSection() {
+function ResolvedSection({
+ searchQuery,
+}: {
+ searchQuery: string;
+}): React.JSX.Element {
const [expanded, setExpanded] = useState(false);
const {
allReports,
@@ -563,6 +568,19 @@ function ResolvedSection() {
{ status: INBOX_DISMISSED_STATUS_FILTER, ordering: "-updated_at" },
{ enabled: expanded, pageSize: 25 },
);
+ const matchingReports = useMemo(
+ () => filterReportsBySearch(allReports, searchQuery),
+ [allReports, searchQuery],
+ );
+ const searchActive = searchQuery.trim().length > 0;
+ const canAutoPageSearch =
+ searchActive && hasNextPage && allReports.length < AUTOPAGE_REPORT_LIMIT;
+
+ useEffect(() => {
+ if (!expanded || !canAutoPageSearch || isFetchingNextPage) return;
+ void fetchNextPage();
+ }, [expanded, canAutoPageSearch, isFetchingNextPage, fetchNextPage]);
+
return (
<section className="flex flex-col gap-1.5">
<button
@@ -581,16 +599,24 @@ function ResolvedSection() {
<div className="flex justify-center py-3">
<Spinner />
</div>
- ) : allReports.length === 0 ? (
- <p className="px-1 py-2 text-[13.5px] text-gray-10">
- Nothing resolved or archived yet.
- </p>
) : (
<div className="flex flex-col gap-1">
- {allReports.map((report) => (
+ {matchingReports.length === 0 && !canAutoPageSearch && (
+ <p className="px-1 py-2 text-[13.5px] text-gray-10">
+ {searchActive
+ ? "No resolved or archived reports match your search. Try a different search."
+ : "Nothing resolved or archived yet."}
+ </p>
+ )}
+ {matchingReports.map((report) => (
<InboxReportRow key={report.id} report={report} />
))}
- {hasNextPage && (
+ {isFetchingNextPage && (
+ <div className="flex justify-center py-2">
+ <Spinner />
+ </div>
+ )}
+ {hasNextPage && !canAutoPageSearch && (
<Button
type="button"
variant="link-muted"
@@ -599,7 +625,7 @@ function ResolvedSection() {
disabled={isFetchingNextPage}
onClick={() => fetchNextPage()}
>
- {isFetchingNextPage ? <Spinner /> : "Show more"}
+ Show more
</Button>
)}
</div>