-
Notifications
You must be signed in to change notification settings - Fork 281
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
fix(clerk-js): Remove internal useCore hooks #2111
fix(clerk-js): Remove internal useCore hooks #2111
Conversation
🦋 Changeset detectedLatest commit: ee24072 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
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 |
3a08302
to
37e8513
Compare
37e8513
to
e9d23e0
Compare
dde7159
to
9ad4505
Compare
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.
❓ Instead of replacing user.
with user?.
in the components where useUser()
hook is used, shouldn't we add a guard if (!user) return null;
?
❓ Instead of adding the if (!user) return null;
guard could we move that up the hierarchy to avoid repeating this guard to all the components of eg UserProfile
/ OrganizationSwitcher
? (If so, let's verify that all components that need user
have the guard and add a separate PR to make that improvement)
|
||
if (!user) { | ||
return null; | ||
} |
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 PersonalAccountPreview
when user is not available or the useCoreUser()
has different behaviour from the useUser()
?
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 withCoreUserGuard
so we are safe. It doesn't really matter if we do user?.something
or return null.
Here we did that because it was helping with the deconstruction.
|
||
if (!organization) { | ||
if (!organization || !user) { |
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.
same as above
@@ -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(); |
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.
❓ Don't we need if (!user) return null;
guard here?
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.
OrganizationProfile is wrapped in withCoreUserGuard
so we are safe.
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.
🔧 remove this empty file.
b46658d
to
41fed9e
Compare
…er -> useSession, useUser
…nization (#2113) this also include useOrganizationList
dc7b7a4
to
ee24072
Compare
Description
This PR:
@clerk/shared/react
asuseSession
.@clerk/shared/react
asuseUser
.@clerk/shared/react
asuseClerk
.The changes for the clerk-js package are applied inside the
ui.retheme
and theui
directoryChecklist
npm test
runs as expected.npm run build
runs as expected.Type of change
Packages affected
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/clerk-expo
@clerk/fastify
gatsby-plugin-clerk
@clerk/localizations
@clerk/nextjs
@clerk/clerk-react
@clerk/remix
@clerk/clerk-sdk-node
@clerk/shared
@clerk/themes
@clerk/types
build/tooling/chore