Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/orange-tigers-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@clerk/clerk-js': minor
'@clerk/shared': minor
'@clerk/clerk-react': minor
'@clerk/types': minor
---

Introduces userInvitations from `useOrganizationList`

`userInvitations` is a paginated list of data. It can be used to create Paginated tables or Infinite lists.

98 changes: 50 additions & 48 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
} from '@clerk/types';

import { unixEpochToDate } from '../../utils/date';
import { convertPageToOffset } from '../../utils/pagesToOffset';
import { BaseResource } from './internal';

export class UserOrganizationInvitation extends BaseResource implements UserOrganizationInvitationResource {
Expand All @@ -32,7 +33,7 @@ export class UserOrganizationInvitation extends BaseResource implements UserOrga
return await BaseResource._fetch({
path: '/me/organization_invitations',
method: 'GET',
search: params as any,
search: convertPageToOffset(params) as any,
})
.then(res => {
const { data: invites, total_count } =
Expand Down
10 changes: 7 additions & 3 deletions packages/clerk-js/src/ui/contexts/CoreClerkContextWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import React from 'react';

import { CoreClerkContext } from './CoreClerkContext';
import { CoreClientContext } from './CoreClientContext';
import { CoreOrganizationContext } from './CoreOrganizationContext';
import { CoreOrganizationProvider } from './CoreOrganizationContext';
import { CoreSessionContext } from './CoreSessionContext';
import { CoreUserContext } from './CoreUserContext';
import { assertClerkSingletonExists } from './utils';

type CoreClerkContextWrapperProps = {
clerk: Clerk;
children: React.ReactNode;
swrConfig?: any;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you please explain why we need 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.

This is passed from MockClerkProvider down to CoreOrganizationProvider in order to clear swr cache between tests

};

type CoreClerkContextProviderState = Resources;
Expand Down Expand Up @@ -51,9 +52,12 @@ export function CoreClerkContextWrapper(props: CoreClerkContextWrapperProps): JS
<CoreClerkContext.Provider value={clerkCtx}>
<CoreClientContext.Provider value={clientCtx}>
<CoreSessionContext.Provider value={sessionCtx}>
<CoreOrganizationContext.Provider value={organizationCtx}>
<CoreOrganizationProvider
{...organizationCtx.value}
swrConfig={props.swrConfig}
>
<CoreUserContext.Provider value={userCtx}>{props.children}</CoreUserContext.Provider>
</CoreOrganizationContext.Provider>
</CoreOrganizationProvider>
</CoreSessionContext.Provider>
</CoreClientContext.Provider>
</CoreClerkContext.Provider>
Expand Down
4 changes: 2 additions & 2 deletions packages/clerk-js/src/ui/contexts/CoreOrganizationContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { OrganizationContext, useOrganization, useOrganizationList, useOrganizations } from '@clerk/shared';
import { OrganizationProvider, useOrganization, useOrganizationList, useOrganizations } from '@clerk/shared';

export const CoreOrganizationContext = OrganizationContext;
export const CoreOrganizationProvider = OrganizationProvider;
export const useCoreOrganization = useOrganization;
export const useCoreOrganizationList = useOrganizationList;
export const useCoreOrganizations = useOrganizations;
Loading