fix: exclude organizationId from autoPagination params in listOrganizationFeatureFlags#1461
Merged
gjtorikian merged 1 commit intomainfrom Feb 3, 2026
Conversation
nicknisi
approved these changes
Feb 3, 2026
Contributor
Greptile OverviewGreptile SummaryFixed a pagination bug in Key changes:
Issues found:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant Organizations
participant AutoPaginatable
participant API
Client->>Organizations: listOrganizationFeatureFlags({organizationId, ...options})
Organizations->>Organizations: Extract organizationId from options
Organizations->>API: GET /organizations/{organizationId}/feature-flags?limit=10
API-->>Organizations: Response with list_metadata.after
Organizations->>AutoPaginatable: new AutoPaginatable(response, apiCall, paginationOptions)
Note over AutoPaginatable: paginationOptions excludes organizationId
AutoPaginatable-->>Client: Return AutoPaginatable instance
Client->>AutoPaginatable: autoPagination()
AutoPaginatable->>API: GET /organizations/{organizationId}/feature-flags?after=cursor&limit=100
Note over API: organizationId NOT in query params<br/>(only in URL path)
API-->>AutoPaginatable: Next page data
AutoPaginatable-->>Client: All paginated results
|
Comment on lines
+569
to
+571
| const secondCallParams = fetchSearchParams(); | ||
| expect(secondCallParams).not.toHaveProperty('organizationId'); | ||
| expect(secondCallParams).toHaveProperty('after', 'flag_next_page'); |
Contributor
There was a problem hiding this comment.
fetchSearchParams() returns params from fetch.mock.calls[0][0] (the first call), not the second pagination call. To check the second request:
Suggested change
| const secondCallParams = fetchSearchParams(); | |
| expect(secondCallParams).not.toHaveProperty('organizationId'); | |
| expect(secondCallParams).toHaveProperty('after', 'flag_next_page'); | |
| // Check that the second request (pagination) does not include organizationId | |
| const secondCallParams = Object.fromEntries(new URL(String(fetch.mock.calls[1][0])).searchParams); | |
| expect(secondCallParams).not.toHaveProperty('organizationId'); | |
| expect(secondCallParams).toHaveProperty('after', 'flag_next_page'); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/organizations/organizations.spec.ts
Line: 569:571
Comment:
`fetchSearchParams()` returns params from `fetch.mock.calls[0][0]` (the first call), not the second pagination call. To check the second request:
```suggestion
// Check that the second request (pagination) does not include organizationId
const secondCallParams = Object.fromEntries(new URL(String(fetch.mock.calls[1][0])).searchParams);
expect(secondCallParams).not.toHaveProperty('organizationId');
expect(secondCallParams).toHaveProperty('after', 'flag_next_page');
```
How can I resolve this? If you propose a fix, please make it concise.7918110 to
6722ae6
Compare
…ationFeatureFlags
6722ae6 to
0c325d9
Compare
Merged
gjtorikian
added a commit
that referenced
this pull request
Feb 3, 2026
## Description This release has two new features: * #1458 * #1460 and one bug fix: * #1461 ## Documentation Does this require changes to the WorkOS Docs? E.g. the [API Reference](https://workos.com/docs/reference) or code snippets need updates. ``` [ ] Yes ``` If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The organizationId was being passed to AutoPaginatable constructor which caused it to be included as a query parameter in subsequent pagination requests. The API rejects this because organizationId is already part of the URL path.
Fixes #1459
Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.