Skip to content

Commit

Permalink
chore(clerk-js): Move AcceptedInvitationsProvider inside ui/contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef committed Dec 22, 2023
1 parent 842f8bb commit e872818
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 53 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { useId } from 'react';

import { withOrganizationsEnabledGuard } from '../../common';
import { withCoreUserGuard } from '../../contexts';
import { AcceptedInvitationsProvider, withCoreUserGuard } from '../../contexts';
import { Flow } from '../../customizables';
import { Popover, withCardStateProvider, withFloatingTree } from '../../elements';
import { usePopover } from '../../hooks';
import { InPlaceAcceptedInvitationsProvider } from './InPlaceAcceptedInvitations';
import { OrganizationSwitcherPopover } from './OrganizationSwitcherPopover';
import { OrganizationSwitcherTrigger } from './OrganizationSwitcherTrigger';

Expand All @@ -19,7 +18,7 @@ const _OrganizationSwitcher = withFloatingTree(() => {

return (
<Flow.Root flow='organizationSwitcher'>
<InPlaceAcceptedInvitationsProvider>
<AcceptedInvitationsProvider>
<OrganizationSwitcherTrigger
ref={reference}
onClick={toggle}
Expand All @@ -38,7 +37,7 @@ const _OrganizationSwitcher = withFloatingTree(() => {
style={{ ...styles }}
/>
</Popover>
</InPlaceAcceptedInvitationsProvider>
</AcceptedInvitationsProvider>
</Flow.Root>
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import type {
import type { PropsWithChildren } from 'react';

import { InfiniteListSpinner } from '../../common';
import { useAcceptedInvitations } from '../../contexts';
import { Box, Button, descriptors, Flex, localizationKeys, Text } from '../../customizables';
import { Actions, OrganizationPreview, PreviewButton, useCardState, withCardStateProvider } from '../../elements';
import { useInView } from '../../hooks';
import { SwitchArrowRight } from '../../icons';
import type { PropsOfComponent } from '../../styledSystem';
import { common } from '../../styledSystem';
import { handleError } from '../../utils';
import { useInPlaceAcceptedInvitations } from './InPlaceAcceptedInvitations';
import { organizationListParams, populateCacheUpdateItem } from './utils';

const useFetchInvitations = () => {
Expand Down Expand Up @@ -136,7 +136,7 @@ const InvitationPreview = withCardStateProvider(
userInvitations: organizationListParams.userInvitations,
userMemberships: organizationListParams.userMemberships,
});
const { acceptedInvitations, setAcceptedInvitations } = useInPlaceAcceptedInvitations();
const { acceptedInvitations, setAcceptedInvitations } = useAcceptedInvitations();
const acceptedOrganization = acceptedInvitations.find(item => item.invitation.id === invitation.id)?.organization;

const handleAccept = () => {
Expand Down
1 change: 1 addition & 0 deletions packages/clerk-js/src/ui/contexts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './OptionsContext';
export * from './CoreSessionContext';
export * from './CoreClientContext';
export * from './CoreClerkContextWrapper';
export * from './AcceptedUserInvitations';

0 comments on commit e872818

Please sign in to comment.