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

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

Merged
merged 5 commits into from
Sep 26, 2023

Conversation

panteliselef
Copy link
Member

@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

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
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
Member Author

Choose a reason for hiding this comment

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

Copy link
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
Member 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
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
Member 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
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.

@@ -232,6 +291,10 @@ export const useOrganization: UseOrganization = params => {
? () => [] as OrganizationMembershipResource[]
: () => clerk.organization?.getMemberships(membershipListParams);

if (invitationListParams) {
deprecated('invitationList in useOrganization', 'Use the `invitations` property and return value instead.');
Copy link
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
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