Skip to content

Commit 93023f8

Browse files
Add support for passing isSignUp as a property in preload checks function
1 parent ff08dd7 commit 93023f8

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

lib/ts/recipe/authRecipe/components/feature/authPage/authPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ async function buildAndSetChildProps(
508508

509509
for (const a of authComps) {
510510
if (a.type === "FULL_PAGE") {
511-
const preloadRes = await a.preloadInfoAndRunChecks(firstFactors, userContext);
511+
const preloadRes = await a.preloadInfoAndRunChecks(firstFactors, userContext, isSignUp);
512512
// We skip setting if the auth page unmounted while we were checking
513513
// if we should show any full page comps
514514
if (abort.aborted) {

lib/ts/recipe/webauthn/prebuiltui.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ export class WebauthnPreBuiltUI extends RecipeRouter {
8383
return [
8484
{
8585
type: "FULL_PAGE",
86-
async preloadInfoAndRunChecks(firstFactors) {
86+
async preloadInfoAndRunChecks(firstFactors, _, isSignUp) {
8787
return {
88-
shouldDisplay: firstFactors.length === 1 && firstFactors.includes(FactorIds.WEBAUTHN),
88+
shouldDisplay:
89+
isSignUp && firstFactors.length === 1 && firstFactors.includes(FactorIds.WEBAUTHN),
8990
preloadInfo: {},
9091
};
9192
},

lib/ts/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,8 @@ export type FullPageAuthComponent<PreloadInfoType = any> = {
437437
type: "FULL_PAGE";
438438
preloadInfoAndRunChecks: (
439439
firstFactors: string[],
440-
userContext: UserContext
440+
userContext: UserContext,
441+
isSignUp: boolean
441442
) => Promise<{ shouldDisplay: true; preloadInfo: PreloadInfoType } | { shouldDisplay: false }>;
442443
component: React.FC<FullPageAuthComponentProps<PreloadInfoType>>;
443444
};

0 commit comments

Comments
 (0)