-
Notifications
You must be signed in to change notification settings - Fork 460
feat(elements): Complete and Reset Updates #3343
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
Changes from all commits
7784748
a396f26
ca95d84
fcc3e73
7e74b27
b1aad9c
a60c229
b276027
1978150
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| '@clerk/elements': patch | ||
| --- | ||
|
|
||
| This release includes various smaller fixes and one dependency update: | ||
|
|
||
| - `xstate` was updated from `5.12.0` to `5.13.0` | ||
| - Previously, the contents of the `fallback` prop were sometimes shown even if the user wasn't on the `start` step. This bug is fixed now. | ||
| - Upon completion of an sign-in/sign-up attempt, don't immediately return to the `start` step. This fixes the issue of a "flash of content" that could e.g. be seen during sign-in with OAuth providers. | ||
| - Some underlying fixes in Clerk Elements' XState logic were applied to make sure that during a sign-in/sign-up attempt the state is properly maintained. For example, if you visit an already completed attempt (some step of that flow) it now properly keeps track of that state. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,9 @@ function SignInFlowProvider({ children, exampleMode }: SignInFlowProviderProps) | |
| actor.send(evt); | ||
| } | ||
| }); | ||
| }, [clerk, exampleMode, formRef, router]); | ||
|
|
||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [clerk, exampleMode, formRef?.id, !!router]); | ||
|
|
||
| return <SignInRouterCtx.Provider actorRef={actor}>{children}</SignInRouterCtx.Provider>; | ||
| } | ||
|
|
@@ -94,6 +96,7 @@ export function SignInRoot({ | |
|
|
||
| // TODO: eventually we'll rely on the framework SDK to specify its host router, but for now we'll default to Next.js | ||
| const router = useNextRouter(); | ||
| const isRootPath = path === router.pathname(); | ||
|
Member
Author
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. This is required, on both Sign Up and Sign In, otherwise, in the case of callbacks, the fallback will show regardless. |
||
|
|
||
| return ( | ||
| <Router | ||
|
|
@@ -102,9 +105,11 @@ export function SignInRoot({ | |
| > | ||
| <FormStoreProvider> | ||
| <SignInFlowProvider exampleMode={exampleMode}> | ||
| <ClerkLoading> | ||
| <Form>{fallback}</Form> | ||
| </ClerkLoading> | ||
| {isRootPath ? ( | ||
| <ClerkLoading> | ||
| <Form>{fallback}</Form> | ||
| </ClerkLoading> | ||
| ) : null} | ||
| <ClerkLoaded>{children}</ClerkLoaded> | ||
| </SignInFlowProvider> | ||
| </FormStoreProvider> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,7 +80,7 @@ export function SignInStrategy({ children, name }: SignInStrategyProps) { | |
| } | ||
|
|
||
| return () => { | ||
| if (factorCtx) { | ||
| if (factorCtx?.getSnapshot().status === 'active') { | ||
|
Member
Author
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. Ensure we only run this event on an active machine. |
||
| factorCtx.send({ type: 'STRATEGY.UNREGISTER', factor: name as unknown as SignInFactor }); | ||
| } | ||
| }; | ||
|
|
||
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.
I saw that
formRefandrouterwere causing many unnecessary re-renders. I narrowed the checks down here and in sign up to optimize.