Skip to content

New getInvitations in clerk-js and invitations from useOrganization#1766

Merged
panteliselef merged 5 commits intomainfrom
ORG-218
Sep 26, 2023
Merged

New getInvitations in clerk-js and invitations from useOrganization#1766
panteliselef merged 5 commits intomainfrom
ORG-218

Conversation

@panteliselef
Copy link
Copy Markdown
Contributor

@panteliselef panteliselef commented Sep 22, 2023

Description

This PR

  • deprecates getPendingInvitations which did not allow for filtering by status
  • introduces getInvitations which support the new pagination params and filtering
  • deprecates invitationList as params and return value of useOrganization
  • introduces invitations which support paginated responces, build-in pagination, and infinite loading.

It was the missing part that brings our organization hooks in harmony between their APIs

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/remix
  • @clerk/types
  • @clerk/themes
  • @clerk/localizations
  • @clerk/clerk-expo
  • @clerk/backend
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/fastify
  • @clerk/chrome-extension
  • gatsby-plugin-clerk
  • build/tooling/chore

@panteliselef panteliselef self-assigned this Sep 22, 2023
@panteliselef panteliselef requested a review from a team as a code owner September 22, 2023 08:26
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Sep 22, 2023

🦋 Changeset detected

Latest commit: 27448be

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@clerk/shared Patch
@clerk/clerk-js Patch
@clerk/types Patch
@clerk/fastify Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/backend Patch
gatsby-plugin-clerk Patch
@clerk/localizations Patch
@clerk/nextjs Patch
@clerk/clerk-sdk-node Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

data: requests.map(request => new OrganizationInvitation(request)),
};
})
.catch(() => ({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Catching the error at this point prevents the global error handler of the FAPI client to kick-in. Is there a specific reason we want to do this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I am not sure if it's correct thought. We should the error bubble up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't be breaking change to change it now ? Shall we aim to fix for v5 ?

isLoaded: boolean;
organization: OrganizationResource | null;
/**
* @deprecated Use `invitations` instead
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dimkl Introduced a deprecated utility function that logs a deprecation message for our customers. You should use it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on it

data: requests.map(request => new OrganizationInvitation(request)),
};
})
.catch(() => ({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I am not sure if it's correct thought. We should the error bubble up.

: () => clerk.organization?.getMemberships(membershipListParams);

if (invitationListParams) {
deprecated('invitationList in useOrganization', 'Use the `invitations` property and return value instead.');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@panteliselef panteliselef added this pull request to the merge queue Sep 26, 2023
Merged via the queue into main with commit 0c572a4 Sep 26, 2023
@panteliselef panteliselef deleted the ORG-218 branch September 26, 2023 10:51
@clerk-cookie clerk-cookie mentioned this pull request Sep 26, 2023
@clerk-cookie
Copy link
Copy Markdown
Collaborator

This PR has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@clerk clerk locked as resolved and limited conversation to collaborators Sep 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants