Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chilled-dots-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/elements": patch
---

Addresses the issue where sign-in factors were not properly falling back to empty arrays.
4 changes: 3 additions & 1 deletion packages/elements/src/react/sign-in/choose-strategy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ export const SignInSupportedStrategy = React.forwardRef<SignInSupportedStrategyE

const supportedFirstFactors = snapshot.context.clerk.client.signIn.supportedFirstFactors;
const supportedSecondFactors = snapshot.context.clerk.client.signIn.supportedSecondFactors;
const factor = [...supportedFirstFactors, ...supportedSecondFactors].find(factor => name === factor.strategy);
const factor = [...(supportedFirstFactors ?? []), ...(supportedSecondFactors ?? [])].find(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can move the fallback value to the declarations above 👀

factor => name === factor.strategy,
);

const currentFactor = useSelector(
(snapshot.children[SignInRouterSystemId.firstFactor] ||
Expand Down