Add inbox issue search fallback

This commit is contained in:
Dotta 2026-04-11 06:49:23 -05:00
parent 03a2cf5c8a
commit fcab770518
3 changed files with 140 additions and 6 deletions

View file

@ -20,6 +20,7 @@ import {
getApprovalsForTab,
getInboxWorkItems,
getInboxKeyboardSelectionIndex,
getInboxSearchFallbackIssues,
getRecentTouchedIssues,
getUnreadTouchedIssues,
groupInboxWorkItems,
@ -611,6 +612,65 @@ describe("inbox helpers", () => {
).toEqual(["newer", "older"]);
});
it("uses remote issue results only when local inbox search has no matches", () => {
const remoteMatch = makeIssue("remote-match", false);
remoteMatch.status = "in_progress";
expect(
getInboxSearchFallbackIssues({
query: "pull/3303",
filteredWorkItems: [],
archivedSearchIssues: [],
remoteIssues: [remoteMatch],
issueFilters: {
statuses: ["in_progress"],
priorities: [],
assignees: [],
labels: [],
projects: [],
workspaces: [],
showRoutineExecutions: false,
},
}).map((issue) => issue.id),
).toEqual(["remote-match"]);
expect(
getInboxSearchFallbackIssues({
query: "pull/3303",
filteredWorkItems: [{ kind: "issue", timestamp: 1, issue: makeIssue("local", false) }],
archivedSearchIssues: [],
remoteIssues: [remoteMatch],
issueFilters: {
statuses: [],
priorities: [],
assignees: [],
labels: [],
projects: [],
workspaces: [],
showRoutineExecutions: false,
},
}),
).toEqual([]);
expect(
getInboxSearchFallbackIssues({
query: "pull/3303",
filteredWorkItems: [],
archivedSearchIssues: [makeIssue("archived", false)],
remoteIssues: [remoteMatch],
issueFilters: {
statuses: [],
priorities: [],
assignees: [],
labels: [],
projects: [],
workspaces: [],
showRoutineExecutions: false,
},
}),
).toEqual([]);
});
it("defaults the remembered inbox tab to mine and persists all", () => {
localStorage.clear();
expect(loadLastInboxTab()).toBe("mine");