Skip to content

Commit

Permalink
fix(clerk-js): Properly show the deprecation warnings for usage of li…
Browse files Browse the repository at this point in the history
…mit and offset (#1904)

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

* chore(clerk-js): Add changeset
  • Loading branch information
panteliselef authored Oct 18, 2023
1 parent 21f61ce commit 112b90b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
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

0 comments on commit 112b90b

Please sign in to comment.