Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-9307: fix(work): keep an issue opened from the Inbox lit there, not in Views or Projects (#10642)
Jiayuan Zhang9ec1b935f73d
diff --git a/packages/views/layout/panels/inbox-section.tsx b/packages/views/layout/panels/inbox-section.tsxindex fdc5ca9adb..e16c2a9e43 100644--- a/packages/views/layout/panels/inbox-section.tsx+++ b/packages/views/layout/panels/inbox-section.tsx@@ -95,7 +95,13 @@ export function useInboxSectionRows(wsId: string | undefined, openKey: string |const collapsed = useSidebarTreeStore((s) => s.inboxCollapsed);const [expandedWsId, setExpandedWsId] = useState<string | null>(null);const expanded = expandedWsId === (wsId ?? null);- const displayed = useMemo(() => (expanded ? rows : rows.slice(0, limit)), [expanded, rows, limit]);+ // Newer notifications must not push the open row past the limit: the row+ // would leave, and the open issue's highlight with it.+ const displayed = useMemo(() => {+ if (expanded) return rows;+ const open = openKey ? rows.findIndex((item) => (item.issue_id ?? item.id) === openKey) : -1;+ return open >= limit ? [...rows.slice(0, limit - 1), rows[open]!] : rows.slice(0, limit);+ }, [expanded, rows, limit, openKey]);// A collapsed section shows no rows, so it lights none.const shownIssueIds = useMemo(() => new Set(collapsed ? [] : displayed.flatMap((item) => (item.issue_id ? [item.issue_id] : []))),diff --git a/packages/views/layout/panels/work-panel.test.tsx b/packages/views/layout/panels/work-panel.test.tsxindex fe54d24dab..7543edd5c6 100644--- a/packages/views/layout/panels/work-panel.test.tsx+++ b/packages/views/layout/panels/work-panel.test.tsx@@ -323,6 +323,39 @@ describe("WorkPanel Inbox highlight", () => {);expect(inInbox()).toBeNull();});++ it("lights an issue opened from a row's hover card in the Inbox", async () => {+ renderPanel("/acme/my-issues", [], [], [], [inboxItem(ISSUE)]);+ await within(await waitFor(inMyIssues)).findByRole("link", { name: ISSUE.title });+ fireEvent.mouseEnter(within(inInbox()).getByRole("link", { name: INBOX_ROW_NAME }).parentElement!);+ fireEvent.click(await screen.findByRole("link", { name: "Open" }, { timeout: 2000 }));++ expect(within(inInbox()).getByRole("link", { name: INBOX_ROW_NAME })).toHaveAttribute("aria-current", "page");+ expect(within(inMyIssues()).getByRole("link", { name: ISSUE.title })).not.toHaveAttribute("aria-current");+ });++ it("keeps the open row lit while newer notifications push it past the limit", async () => {+ const others = Array.from({ length: 5 }, (_, i) => ({+ ...OTHER,+ id: `00000000-0000-4000-8000-00000000000${i}`,+ title: `Other ${i}`,+ }));+ const notified = (issue: Issue, minute: number) => ({+ ...inboxItem(issue),+ created_at: `2026-11-10T08:0${minute}:00Z`,+ });+ const older = [notified(ISSUE, 0), ...others.slice(0, 4).map((issue, i) => notified(issue, i + 1))];+ const qc = renderPanel("/acme/my-issues", [], [], [], older);+ await within(await waitFor(inMyIssues)).findByRole("link", { name: ISSUE.title });+ fireEvent.click(within(inInbox()).getByRole("link", { name: INBOX_ROW_NAME }));+ act(() => {+ qc.setQueryData(inboxListOptions("ws-1").queryKey, [...older, notified(others[4]!, 6)]);+ });++ await within(inInbox()).findByRole("link", { name: /^Other 4/ });+ expect(within(inInbox()).getByRole("link", { name: INBOX_ROW_NAME })).toHaveAttribute("aria-current", "page");+ expect(within(inMyIssues()).getByRole("link", { name: ISSUE.title })).not.toHaveAttribute("aria-current");+ });});describe("WorkPanel issue highlight", () => {diff --git a/packages/views/layout/panels/work-panel.tsx b/packages/views/layout/panels/work-panel.tsxindex 9827deee4f..119807882b 100644--- a/packages/views/layout/panels/work-panel.tsx+++ b/packages/views/layout/panels/work-panel.tsx@@ -124,9 +124,12 @@ export function WorkPanel() {requestLocate(null);const path = new URL(link.getAttribute("href") ?? "", window.location.href).pathname;const segment = routeSegment(path, p.issues());+ // An Inbox row's hover card renders in a portal, outside the row's list.const list = link.closest("[data-pinned-section]")? PINS_LIST- : (link.closest("[data-sidebar-list]")?.getAttribute("data-sidebar-list") ?? null);+ : link.closest("[data-inbox-card]")+ ? INBOX_LIST+ : (link.closest("[data-sidebar-list]")?.getAttribute("data-sidebar-list") ?? null);setClickedIssue(segment ? { segment, list } : null);// Inbox rows link by issue id, which is what the issue header compares.if (segment && wsId) rememberSidebarIssue(wsId, list === INBOX_LIST ? segment : null);