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): return to the inbox list from the triage rail (#104021)

posthog[bot]3b28f93c6bda
diff --git a/products/desktop/docs/SELF-DRIVING-REPORTS.md b/products/desktop/docs/SELF-DRIVING-REPORTS.md
index 476b95f21051..d7a955f9b8e7 100644
--- a/products/desktop/docs/SELF-DRIVING-REPORTS.md
+++ b/products/desktop/docs/SELF-DRIVING-REPORTS.md
@@ -36,6 +36,8 @@ Older servers that omit either field use cached task details instead. The cache
The triage count includes only loaded reports that need a decision. Load more reports to check the next page.
A callback error after task startup does not change a successful start into a failed start. Older servers without task assignments keep their existing queue behavior.
Triage hides the sidebar. Exiting triage or opening a report restores it without changing its saved width or open setting.
+Select Self-driving in the navigation rail during triage to return to the report list and open its sidebar.
+From an open report, the same control opens the sidebar and focuses its search without closing the report.
Press T from the report list or an open report to start triage when triage is enabled. The shortcut does not run while you type in a field.
To filter reports for a user, open Filter reports, then hover over Scope.
diff --git a/products/desktop/packages/ui/src/features/canvas/components/NavRail.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/NavRail.test.tsx
index 2a5e960a81c4..ac39c2eefa86 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/NavRail.test.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/NavRail.test.tsx
@@ -122,6 +122,7 @@ import {
} from "@posthog/ui/features/canvas/stores/channelPaneStore";
import { useCurrentChannelStore } from "@posthog/ui/features/canvas/stores/currentChannelStore";
import { useSidebarSearchStore } from "@posthog/ui/features/canvas/stores/sidebarSearchStore";
+import { useSidebarStore } from "@posthog/ui/features/sidebar/sidebarStore";
import { NavRail } from "./NavRail";
it("stays above floating sidebar layers", () => {
@@ -169,6 +170,7 @@ describe("NavRail", () => {
useCurrentChannelStore.setState({ currentChannelId: null });
useChannelPaneStore.setState({ pane: "channel" });
useSidebarSearchStore.setState({ focusRequest: 0 });
+ useSidebarStore.setState({ open: false, width: 300 });
rememberVisits({});
clearKeepListForRoute();
});
@@ -497,18 +499,51 @@ describe("NavRail", () => {
expect(mocks.navigate).not.toHaveBeenCalled();
});
- it("counts the report a list opened as being on the list", async () => {
- const user = userEvent.setup();
- mocks.fullPath = "/reports/$reportId";
- mocks.href = "/reports/42?from=%2Finbox";
- rememberVisits({ inbox: { href: "/reports/42?from=%2Finbox" } });
- render(<NavRail />);
+ it.each(["/inbox", "/inbox/triage"])(
+ "restores the sidebar without closing a report opened from %s",
+ async (source) => {
+ const user = userEvent.setup();
+ mocks.fullPath = "/reports/$reportId";
+ mocks.href = `/reports/42?from=${encodeURIComponent(source)}`;
+ rememberVisits({ inbox: { href: mocks.href } });
+ render(<NavRail />);
- await user.click(screen.getByLabelText("Self-driving"));
+ await user.click(screen.getByLabelText("Self-driving"));
- expect(useSidebarSearchStore.getState().focusRequest).toBeGreaterThan(0);
- expect(mocks.navigateToInbox).not.toHaveBeenCalled();
- });
+ expect(useSidebarStore.getState()).toMatchObject({
+ open: true,
+ width: 300,
+ });
+ expect(useSidebarSearchStore.getState().focusRequest).toBeGreaterThan(
+ 0,
+ );
+ expect(mocks.navigateToInbox).not.toHaveBeenCalled();
+ expect(mocks.navigate).not.toHaveBeenCalled();
+ },
+ );
+
+ it.each(["/inbox/triage", "/inbox/triage/", "/inbox/triage?sort=priority"])(
+ "returns from %s to the list instead of focusing a hidden sidebar",
+ async (href) => {
+ const user = userEvent.setup();
+ mocks.fullPath = "/inbox/triage";
+ mocks.href = href;
+ rememberVisits({ inbox: { href: "/reports/42?from=%2Finbox" } });
+ render(<NavRail />);
+
+ await user.click(screen.getByLabelText("Self-driving"));
+
+ expect(mocks.navigateToInbox).toHaveBeenCalledOnce();
+ expect(mocks.navigate).not.toHaveBeenCalled();
+ expect(useSidebarStore.getState()).toMatchObject({
+ open: true,
+ width: 300,
+ });
+ expect(useSidebarSearchStore.getState().focusRequest).toBeGreaterThan(
+ 0,
+ );
+ },
+ );
});
it("peeks at the feed on hover while Activity is somewhere else", async () => {
diff --git a/products/desktop/packages/ui/src/features/canvas/components/railDestinations.ts b/products/desktop/packages/ui/src/features/canvas/components/railDestinations.ts
index d900b6ee1325..a42cfead5e34 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/railDestinations.ts
+++ b/products/desktop/packages/ui/src/features/canvas/components/railDestinations.ts
@@ -28,6 +28,7 @@ import {
formatHotkey,
SHORTCUTS,
} from "@posthog/ui/features/command/keyboard-shortcuts";
+import { isInboxTriagePath } from "@posthog/ui/features/inbox/triageRoute";
import { useSidebarStore } from "@posthog/ui/features/sidebar/sidebarStore";
import type { CountBadgeTone } from "@posthog/ui/primitives/CountBadge";
import { LoopIcon } from "@posthog/ui/primitives/LoopIcon";
@@ -43,6 +44,7 @@ import {
navigateToSpaces,
navigateToSpacesContext,
} from "@posthog/ui/router/navigationBridge";
+import { hrefPath } from "@posthog/ui/router/reportNavigation";
import { getRouterOrNull } from "@posthog/ui/router/routerRef";
import type { ComponentType } from "react";
@@ -103,6 +105,13 @@ function focusColumnSearch(): void {
requestSidebarSearchFocus();
}
+function showInboxList(): void {
+ if (isInboxTriagePath(hrefPath(currentHref() ?? ""))) {
+ navigateToInbox();
+ }
+ focusColumnSearch();
+}
+
/**
* Where each rail destination was when the ACTIVE TAB last left it. Per tab, so
* a pick in one tab can never restore an href another tab established, and so
@@ -212,7 +221,7 @@ const RAIL_DESTINATIONS: readonly RailDestination[] = [
Icon: EnvelopeSimple,
href: "/inbox",
onPick: navigateToInbox,
- onReclick: focusColumnSearch,
+ onReclick: showInboxList,
shortcut: formatHotkey(SHORTCUTS.INBOX),
count: (counts) => counts.inbox,
enabled: (flags) => flags.inbox,