-
Notifications
You must be signed in to change notification settings - Fork 283
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
feat(elements): Add temporary useIsLoading hook #2751
Conversation
🦋 Changeset detectedLatest commit: 4b0d0c0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types 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 |
packages/elements/src/internals/machines/sign-in/sign-in.machine.ts
Outdated
Show resolved
Hide resolved
* Caution: This hook is unstable and may disappear in the future. | ||
* This is a temporary hook until the actual loading API is explored and implemented. | ||
*/ | ||
export const unstable_useIsLoading = () => { |
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.
To keep with React hook naming conventions:
export const unstable_useIsLoading = () => { | |
export const useIsLoading_unstable = () => { |
|
||
const isGlobalLoading = startLoading || firstFactorLoading || secondFactorLoading; | ||
|
||
return [isGlobalLoading, { start: startLoading, firstFactor: firstFactorLoading, secondFactor: secondFactorLoading }]; |
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.
Likely a cleaner/clearer way to handle this in the long-run, but cool for now. On concern though is that it's specific to signIn, and lives in the root React hooks. Mind moving it over?
Co-authored-by: Tom Milewski <[email protected]>
Description
While in #2669 Bryce started implementing a holistic solution, for the Alpha stage we'll opt to providing a temporary
unstable_useIsLoading
hook. Took some bits from #2669 that were useful in any way 👍Once we have thought more about the API for loading states we'll remove this again and tackle the proper solution.
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