Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 469
fix(clerk-js): Remove internal useCore hooks#2111
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
e7bc0299915d4df4bb03b0bfb17c15a163bfc30552bf44875ee24072File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| '@clerk/clerk-js': minor | ||
| '@clerk/shared': minor | ||
| --- | ||
| Move usage of internal useCoreX hooks to useX hooks |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| import { useOrganization, useUser } from '@clerk/shared/react'; | ||
| import { useWizard, Wizard } from '../../common'; | ||
| import { useCoreOrganization, useCoreUser, useOrganizationProfileContext } from '../../contexts'; | ||
| import { useOrganizationProfileContext } from '../../contexts'; | ||
| import type { LocalizationKey } from '../../customizables'; | ||
| import { localizationKeys, Text } from '../../customizables'; | ||
| import { | ||
| @@ -17,10 +19,10 @@ import { OrganizationProfileBreadcrumbs } from './OrganizationProfileNavbar'; | ||
| export const LeaveOrganizationPage = () => { | ||
| const card = useCardState(); | ||
| const { navigateAfterLeaveOrganization } = useOrganizationProfileContext(); | ||
| const { organization } = useCoreOrganization(); | ||
| const user = useCoreUser(); | ||
| const { organization } = useOrganization(); | ||
| const { user } = useUser(); | ||
| if (!organization) { | ||
| if (!organization || !user) { | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above | ||
| return null; | ||
| } | ||
| @@ -50,7 +52,7 @@ export const LeaveOrganizationPage = () => { | ||
| export const DeleteOrganizationPage = () => { | ||
| const card = useCardState(); | ||
| const { navigateAfterLeaveOrganization } = useOrganizationProfileContext(); | ||
| const { organization } = useCoreOrganization(); | ||
| const { organization } = useOrganization(); | ||
| if (!organization) { | ||
| return null; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import { useOrganization, useUser } from '@clerk/shared/react'; | ||
| import type { OrganizationMembershipResource } from '@clerk/types'; | ||
| import { Gate } from '../../common/Gate'; | ||
| import { useCoreOrganization, useCoreUser } from '../../contexts'; | ||
| import { Badge, localizationKeys, Td, Text } from '../../customizables'; | ||
| import { ThreeDotsMenu, useCardState, UserPreview } from '../../elements'; | ||
| import { useFetchRoles, useLocalizeCustomRoles } from '../../hooks/useFetchRoles'; | ||
| @@ -17,7 +17,7 @@ const membershipsParams = { | ||
| export const ActiveMembersList = () => { | ||
| const card = useCardState(); | ||
| const { organization, memberships } = useCoreOrganization(membershipsParams); | ||
| const { organization, memberships } = useOrganization(membershipsParams); | ||
| const { options, isLoading: loadingRoles } = useFetchRoles(); | ||
| @@ -76,9 +76,9 @@ const MemberRow = (props: { | ||
| const { membership, onRemove, onRoleChange, options } = props; | ||
| const { localizeCustomRole } = useLocalizeCustomRoles(); | ||
| const card = useCardState(); | ||
| const user = useCoreUser(); | ||
| const { user } = useUser(); | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ Don't we need Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OrganizationProfile is wrapped in | ||
| const isCurrentUser = user.id === membership.publicUserData.userId; | ||
| const isCurrentUser = user?.id === membership.publicUserData.userId; | ||
| const unlocalizedRoleLabel = options?.find(a => a.value === membership.role)?.label; | ||
| return ( | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ is this a fix to avoid rendering
PersonalAccountPreviewwhen user is not available or theuseCoreUser()has different behaviour from theuseUser()?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OrganizationList is wrapped in
withCoreUserGuardso we are safe. It doesn't really matter if we douser?.somethingor return null.Here we did that because it was helping with the deconstruction.