Skip to content

Commit

Permalink
fix(clerk-js): Move signup id check into an effect within continue st…
Browse files Browse the repository at this point in the history
…ep (#4711)
  • Loading branch information
alexcarpenter authored Dec 5, 2024
1 parent 9a4bf37 commit 8cdfa8f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/clean-rivers-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-js': patch
---

Fixes an issue during sign-up flow where a user lands on the continue step, and proceeds successfully through the sign-up process and gets redirected to AP sign-up due to signUp.id being undefined.
12 changes: 9 additions & 3 deletions packages/clerk-js/src/ui/components/SignUp/SignUpContinue.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useClerk } from '@clerk/shared/react';
import React, { useMemo } from 'react';
import React, { useEffect, useMemo } from 'react';

import { useCoreSignUp, useEnvironment, useSignUpContext } from '../../contexts';
import { descriptors, Flex, Flow, localizationKeys } from '../../customizables';
Expand Down Expand Up @@ -84,9 +84,15 @@ function _SignUpContinue() {
[signUp.missingFields],
);

// Redirect to sign-up if there is no persisted sign-up
useEffect(() => {
// Redirect to sign-up if there is no persisted sign-up
if (!signUp.id) {
void navigate(displayConfig.signUpUrl);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

if (!signUp.id) {
void navigate(displayConfig.signUpUrl);
return <LoadingCard />;
}

Expand Down

0 comments on commit 8cdfa8f

Please sign in to comment.