Skip to content

Commit dc41d23

Browse files
committed
docs(selectors): clarify JSM drain advances start by actual row count
The offset-advancement fix (advance `start` by the rows returned, not the fixed page size) landed in 7b19788; update the TSDoc to match so it no longer reads as advancing by `limit`.
1 parent 7b19788 commit dc41d23

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

  • apps/sim/app/api/tools/jsm

apps/sim/app/api/tools/jsm/selector-requesttypes/route.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ interface JsmRequestTypeValue {
3030

3131
/**
3232
* Drains the offset-paginated JSM `/servicedesk/{id}/requesttype` endpoint,
33-
* advancing `start` by `limit` until `isLastPage === true` (or `_links.next` is
34-
* absent). Bounded by `MAX_JSM_REQUEST_TYPES_PAGES`; emits a `logger.warn` and
35-
* returns the partial set rather than looping unbounded when the cap is hit.
33+
* advancing `start` by the number of rows actually returned until
34+
* `isLastPage === true` (or `_links.next` is absent, or a page comes back
35+
* empty). Advancing by the real row count — not the requested `limit` —
36+
* prevents skipping items if the server returns a short non-final page. Bounded
37+
* by `MAX_JSM_REQUEST_TYPES_PAGES`; emits a `logger.warn` and returns the
38+
* partial set rather than looping unbounded when the cap is hit.
3639
*/
3740
async function fetchAllJsmRequestTypes(
3841
requestTypeUrl: string,

apps/sim/app/api/tools/jsm/selector-servicedesks/route.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ interface JsmServiceDeskValue {
3030

3131
/**
3232
* Drains the offset-paginated JSM `/servicedesk` endpoint, advancing `start` by
33-
* `limit` until `isLastPage === true` (or `_links.next` is absent). Bounded by
34-
* `MAX_JSM_SERVICE_DESKS_PAGES`; emits a `logger.warn` and returns the partial
35-
* set rather than looping unbounded when the cap is hit.
33+
* the number of rows actually returned until `isLastPage === true` (or
34+
* `_links.next` is absent, or a page comes back empty). Advancing by the real
35+
* row count — not the requested `limit` — prevents skipping items if the server
36+
* returns a short non-final page. Bounded by `MAX_JSM_SERVICE_DESKS_PAGES`;
37+
* emits a `logger.warn` and returns the partial set rather than looping
38+
* unbounded when the cap is hit.
3639
*/
3740
async function fetchAllJsmServiceDesks(
3841
baseUrl: string,

0 commit comments

Comments
 (0)