Skip to content
Closed
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/hot-clowns-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-js': patch
---

Only render last use strategy badge when there is a last used strategy available and there is more than one strategy enabled.
7 changes: 5 additions & 2 deletions packages/clerk-js/src/ui/elements/SocialButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ export const SocialButtons = React.memo((props: SocialButtonsRootProps) => {
}

const lastAuthenticationStrategy = clerk.client?.lastAuthenticationStrategy as TStrategy | null;
const shouldShowLastAuthenticationStrategy = strategies.length > 1;
const { strategyRows, lastAuthenticationStrategyPresent } = distributeStrategiesIntoRows<TStrategy>(
[...strategies],
MAX_STRATEGIES_PER_ROW,
lastAuthenticationStrategy,
shouldShowLastAuthenticationStrategy ? lastAuthenticationStrategy : null,
);
const strategyRowOneLength = strategyRows.at(lastAuthenticationStrategyPresent ? 1 : 0)?.length ?? 0;

Expand Down Expand Up @@ -194,7 +195,9 @@ export const SocialButtons = React.memo((props: SocialButtonsRootProps) => {
label={label}
textLocalizationKey={localizedText}
icon={imageOrInitial}
lastAuthenticationStrategy={strategy === lastAuthenticationStrategy}
lastAuthenticationStrategy={
shouldShowLastAuthenticationStrategy && strategy === lastAuthenticationStrategy
}
/>
);
})}
Expand Down