-
Notifications
You must be signed in to change notification settings - Fork 298
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
chore(*): Improve @clerk/clerk-react DX #2328
Conversation
🦋 Changeset detectedLatest commit: 00e342a The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 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 |
79b8de6
to
69c5aa9
Compare
69c5aa9
to
9c95a13
Compare
@@ -48,5 +45,5 @@ export const WithClerk: React.FC<{ | |||
return null; | |||
} | |||
|
|||
return <LoadedGuarantee>{children(clerk as unknown as LoadedClerk)}</LoadedGuarantee>; |
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.
❓ Can you please elaborate what replaces the loaded guarantee?
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.
Nothing used the LoadedGuarantee (or "structure context") since the v4 hook change. We kept it around in case we wanted to use it to throw better errors in cases where the Clerk hooks were used outside the Clerk provider but ended up doing that by simply checking wether the ClerkProvider context exists or not.
Extra context: The LoadedGuarantee (or "structure context") used to wrap all SignedIn and SignedOut components and the older hooks could only be used when nested under these components - this is no longer the case as all hooks return isLoaded
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.
cc @dimkl
packages/react/src/errors/errors.ts
Outdated
isEmailLinkError, | ||
isKnownError, | ||
isMetamaskError, | ||
EmailLinkErrorCode, |
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.
Do we need both isEmailLinkError and EmailLinkErrorCode?
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.
How about exporting ClerkRuntimeError and ClerkAPIResponseError?
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.
Do we need both isEmailLinkError and EmailLinkErrorCode?
I think we should keep only the isEmailLinkError
How about exporting ClerkRuntimeError and ClerkAPIResponseError?
Let's keep only the helpers to allow the consumers of that package to identify and handle those errors but for now since those errors are supposed to be thrown by Clerk let's avoid exposing them.
If we need to use them in any of our packages we can import them from @clerk/shared
9c95a13
to
dd9c187
Compare
161024f
to
6c36681
Compare
@dimkl Rebase |
… withClerk, WithClerk, withSession, WithSession
Actions: - Use `tsc` on success to produce types - Use `emitDeclarationOnly: true` - Replace `d.mts` with `d.ts` types in package.json - Move `setErrorThrowerOptions` definition from `/internal` to `errors.ts` Why: - Enabling `dts` was causing build issues with controlComponents inferred type in `@clerk/remix` package - Emitting declarations only is used to avoid tampering the bundled code which is configured as part of tsup - Using `d.ts` files for types is set because `d.mts` are not generated since we disabled dts option and the generated `d.mts` are the same as `d.ts` files based on some comparisons - Moving the `setErrorThrowerOptions` was done to simplify the dependency tree
…rop EmailLinkErrorCode export
… of X cannot be named without a reference to Y" TS issue: microsoft/TypeScript#47663
6c36681
to
b809288
Compare
Description
Checklist
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