From 112b90bea703a4338970d29532b9119dcaf591a7 Mon Sep 17 00:00:00 2001 From: panteliselef Date: Wed, 18 Oct 2023 10:21:44 +0300 Subject: [PATCH] fix(clerk-js): Properly show the deprecation warnings for usage of limit and offset (#1904) * fix(clerk-js): Properly show the deprecation warnings for usage of limit and offset * chore(clerk-js): Add changeset --- .changeset/pretty-frogs-turn.md | 5 +++++ packages/clerk-js/src/core/resources/Organization.ts | 4 ++-- .../clerk-js/src/core/resources/OrganizationMembership.ts | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) 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 0000000000..dd34fbb92e --- /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. diff --git a/packages/clerk-js/src/core/resources/Organization.ts b/packages/clerk-js/src/core/resources/Organization.ts index e2414a2c06..29019b8d8b 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 9686df2f2b..c96b484cdc 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.',