Skip to content

Commit c51027c

Browse files
authored
fix(ui): add clerk dependency to redirect effect hooks (#7529)
1 parent 7bdcc66 commit c51027c

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/ui": patch
3+
---
4+
5+
Fix redirect conflicts when SignIn and SignUp components are used together on the same page. Added missing dependency arrays to useEffect hooks in redirect functions to prevent unwanted redirects during other component flows.

packages/ui/src/components/SignIn/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function RedirectToSignIn() {
4141
const clerk = useClerk();
4242
React.useEffect(() => {
4343
void clerk.redirectToSignIn();
44-
}, []);
44+
}, [clerk]);
4545
return null;
4646
}
4747

packages/ui/src/components/SignUp/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function RedirectToSignUp() {
2222
const clerk = useClerk();
2323
React.useEffect(() => {
2424
void clerk.redirectToSignUp();
25-
}, []);
25+
}, [clerk]);
2626
return null;
2727
}
2828

0 commit comments

Comments
 (0)