Skip to content

Commit 613bada

Browse files
committed
fix: missing hasPrev in empty issue page, consistent hasPrev in JSON envelopes
- Add hasPrev to the early return in handleOrgAllIssues when issues.length === 0 - Standardize hasPrev in JSON envelopes: always include as boolean (not conditionally)
1 parent 35b4605 commit 613bada

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

src/commands/dashboard/list.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,8 @@ function jsonTransformDashboardList(
186186
const envelope: Record<string, unknown> = {
187187
data: items,
188188
hasMore: result.hasMore,
189+
hasPrev: !!result.hasPrev,
189190
};
190-
if (result.hasPrev) {
191-
envelope.hasPrev = true;
192-
}
193191
if (result.nextCursor) {
194192
envelope.nextCursor = result.nextCursor;
195193
}

src/commands/issue/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ async function handleOrgAllIssues(
940940
const hint = hasMore
941941
? `No issues on this page. Try the next page: ${nextPageHint(org, flags)}`
942942
: `No issues found in organization '${org}'.`;
943-
return { items: [], hasMore, nextCursor, hint };
943+
return { items: [], hasMore, hasPrev, nextCursor, hint };
944944
}
945945

946946
// isMultiProject=true: org-all shows issues from every project, so the ALIAS

src/lib/org-list.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ export function jsonTransformListResult<T>(
118118
) {
119119
envelope.nextCursor = result.nextCursor;
120120
}
121-
if (result.hasPrev) {
122-
envelope.hasPrev = true;
123-
}
121+
envelope.hasPrev = !!result.hasPrev;
124122
if (result.errors && result.errors.length > 0) {
125123
envelope.errors = result.errors;
126124
}

test/commands/dashboard/list.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ describe("dashboard list command", () => {
181181

182182
const output = stdoutWrite.mock.calls.map((c) => c[0]).join("");
183183
const parsed = JSON.parse(output);
184-
expect(parsed).toEqual({ data: [], hasMore: false });
184+
expect(parsed).toEqual({ data: [], hasMore: false, hasPrev: false });
185185
});
186186

187187
// -------------------------------------------------------------------------

0 commit comments

Comments
 (0)