Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(inbox): light the Work panel Inbox row of an issue opened from it again (#10903)

Multica Eve5dcabc501fdb
diff --git a/packages/views/layout/panels/inbox-section.tsx b/packages/views/layout/panels/inbox-section.tsx
index d8004ff3cb..80e630c54a 100644
--- a/packages/views/layout/panels/inbox-section.tsx
+++ b/packages/views/layout/panels/inbox-section.tsx
@@ -559,6 +559,7 @@ function InboxRow({
<AppLink
href={href}
newTabTitle={title}
+ data-issue-id={item.issue_id ?? undefined}
draggable={false}
aria-current={active ? "page" : undefined}
onNavigateInPlace={land}
@@ -807,7 +808,12 @@ function InboxRowCard({
</div>
)}
<div className="-mx-1 mt-1 flex items-center gap-1 border-t border-border pt-2">
- <AppLink href={href} onNavigateInPlace={onOpen} className={buttonVariants({ size: "sm", variant: "secondary" })}>
+ <AppLink
+ href={href}
+ data-issue-id={item.issue_id ?? undefined}
+ onNavigateInPlace={onOpen}
+ className={buttonVariants({ size: "sm", variant: "secondary" })}
+ >
{t(($) => $.panels.work.inbox_open)}
</AppLink>
{unread && (
diff --git a/packages/views/layout/panels/work-panel.test.tsx b/packages/views/layout/panels/work-panel.test.tsx
index 36d821bb38..38d13cc720 100644
--- a/packages/views/layout/panels/work-panel.test.tsx
+++ b/packages/views/layout/panels/work-panel.test.tsx
@@ -321,6 +321,21 @@ describe("WorkPanel Inbox highlight", () => {
expect(allIssues()).not.toHaveAttribute("aria-current");
});
+ it("lights an issue opened from the Inbox at its identifier URL", async () => {
+ const qc = renderPanel("/acme/my-issues", [], [], [], [{ ...inboxItem(ISSUE), issue_identifier: ISSUE.identifier }]);
+ await within(await waitFor(inMyIssues)).findByRole("link", { name: ISSUE.title });
+ const row = within(inInbox()).getByRole("link", { name: INBOX_ROW_NAME });
+ expect(row).toHaveAttribute("href", `/acme/issues/${ISSUE.identifier}`);
+ fireEvent.click(row);
+ // The issue page loads it by its identifier.
+ act(() => qc.setQueryData(issueDetailOptions("ws-1", ISSUE.identifier).queryKey, ISSUE));
+
+ await waitFor(() =>
+ 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("moves the light to the list the issue is clicked in next", async () => {
renderPanel("/acme/my-issues", [], [], [], [inboxItem(ISSUE)]);
await within(await waitFor(inMyIssues)).findByRole("link", { name: ISSUE.title });
diff --git a/packages/views/layout/panels/work-panel.tsx b/packages/views/layout/panels/work-panel.tsx
index 931ff4c88e..f6957377fb 100644
--- a/packages/views/layout/panels/work-panel.tsx
+++ b/packages/views/layout/panels/work-panel.tsx
@@ -143,13 +143,15 @@ export function WorkPanel() {
const link = (event.target as HTMLElement).closest("a[href]");
if (!link) return;
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-inbox-card]")
? INBOX_LIST
: (link.closest("[data-sidebar-list]")?.getAttribute("data-sidebar-list") ?? null);
+ // Inbox links open the issue at its identifier; the Inbox records, and
+ // the issue header compares, the issue's id.
+ const segment = (list === INBOX_LIST && link.getAttribute("data-issue-id")) || routeSegment(path, p.issues());
// A click that opens a tab or window, as AppLink resolves it, leaves this
// page and its records where they are. A desktop tab shares this page's
// store, so an issue the Inbox opens there is recorded beside them.
@@ -159,7 +161,6 @@ export function WorkPanel() {
}
requestLocate(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);
forgetSidebarTabIssue(wsId, segment);