Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(clerk-js): Properly show the deprecation warnings for usage of limit and offset #1904

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/pretty-frogs-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-js': patch
---

Internal fix for deprecation warning when using limi & offset.
4 changes: 2 additions & 2 deletions packages/clerk-js/src/core/resources/Organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@ export class Organization extends BaseResource implements OrganizationResource {
getMemberships: GetMemberships = async getMembershipsParams => {
const isDeprecatedParams = typeof getMembershipsParams === 'undefined' || !getMembershipsParams?.paginated;

if (!(getMembershipsParams as GetMembershipsParams)?.limit) {
if ((getMembershipsParams as GetMembershipsParams)?.limit) {
deprecated(
'limit',
'Use `pageSize` instead in Organization.getMemberships.',
'organization:getMemberships:limit',
);
}
if (!(getMembershipsParams as GetMembershipsParams)?.offset) {
if ((getMembershipsParams as GetMembershipsParams)?.offset) {
deprecated('offset', 'Use `initialPage` instead in Organization.limit.', 'organization:getMemberships:offset');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ export class OrganizationMembership extends BaseResource implements Organization
const isDeprecatedParams =
typeof retrieveMembershipsParams === 'undefined' || !retrieveMembershipsParams?.paginated;

if (!(retrieveMembershipsParams as RetrieveMembershipsParams)?.limit) {
if ((retrieveMembershipsParams as RetrieveMembershipsParams)?.limit) {
deprecated(
'limit',
'Use `pageSize` instead in OrganizationMembership.retrieve.',
'organization-membership:limit',
);
}
if (!(retrieveMembershipsParams as RetrieveMembershipsParams)?.offset) {
if ((retrieveMembershipsParams as RetrieveMembershipsParams)?.offset) {
deprecated(
'offset',
'Use `initialPage` instead in OrganizationMembership.retrieve.',
Expand Down