From 300135ca9e6bbc1352238d41878c5b0f09413701 Mon Sep 17 00:00:00 2001 From: panteliselef Date: Tue, 17 Oct 2023 20:05:17 +0300 Subject: [PATCH 1/2] fix(clerk-js): Properly show the deprecation warnings for usage of limit and offset --- packages/clerk-js/src/core/resources/Organization.ts | 4 ++-- .../clerk-js/src/core/resources/OrganizationMembership.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/clerk-js/src/core/resources/Organization.ts b/packages/clerk-js/src/core/resources/Organization.ts index e2414a2c067..29019b8d8be 100644 --- a/packages/clerk-js/src/core/resources/Organization.ts +++ b/packages/clerk-js/src/core/resources/Organization.ts @@ -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'); } diff --git a/packages/clerk-js/src/core/resources/OrganizationMembership.ts b/packages/clerk-js/src/core/resources/OrganizationMembership.ts index 9686df2f2ba..c96b484cdc7 100644 --- a/packages/clerk-js/src/core/resources/OrganizationMembership.ts +++ b/packages/clerk-js/src/core/resources/OrganizationMembership.ts @@ -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.', From 737d4c3fa6f73e2a7915b5e573cbe2451453a853 Mon Sep 17 00:00:00 2001 From: panteliselef Date: Wed, 18 Oct 2023 10:11:27 +0300 Subject: [PATCH 2/2] chore(clerk-js): Add changeset --- .changeset/pretty-frogs-turn.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/pretty-frogs-turn.md diff --git a/.changeset/pretty-frogs-turn.md b/.changeset/pretty-frogs-turn.md new file mode 100644 index 00000000000..dd34fbb92e2 --- /dev/null +++ b/.changeset/pretty-frogs-turn.md @@ -0,0 +1,5 @@ +--- +'@clerk/clerk-js': patch +--- + +Internal fix for deprecation warning when using limi & offset.