Skip to content

Commit 01ce094

Browse files
committed
fix(api): discard nextCursor when trimming overshot events in listIssueEvents
When the API returns more events than the requested limit, the function now returns without nextCursor to prevent cursor-position skips. This matches the pattern in listIssuesAllPages.
1 parent e6d4340 commit 01ce094

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/api/events.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export async function listIssueEvents(
197197

198198
const config = await getOrgSdkConfig(orgSlug);
199199

200-
let allEvents: IssueEvent[] = [];
200+
const allEvents: IssueEvent[] = [];
201201
let currentCursor = cursor;
202202
let nextCursor: string | undefined;
203203

@@ -235,7 +235,7 @@ export async function listIssueEvents(
235235
// Trim to exact limit; discard nextCursor if we overshot to avoid
236236
// cursor-position skips (same pattern as listIssuesAllPages).
237237
if (allEvents.length > limit) {
238-
allEvents = allEvents.slice(0, limit);
238+
return { data: allEvents.slice(0, limit) };
239239
}
240240

241241
return { data: allEvents, nextCursor };

0 commit comments

Comments
 (0)