Skip to content

Commit 8568534

Browse files
authored
fix(clerk-js): Handle gracefully yet unknown to our components Web3 providers (#4263)
1 parent a361200 commit 8568534

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.changeset/hot-pants-change.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/clerk-js": patch
3+
---
4+
5+
Handle gracefully yet unknown to our components Web3 providers

packages/clerk-js/src/ui/hooks/useEnabledThirdPartyProviders.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type ThirdPartyProviderToDataMap = {
2323
};
2424

2525
const oauthStrategies = OAUTH_PROVIDERS.map(p => p.strategy);
26+
const web3Strategies = WEB3_PROVIDERS.map(p => p.strategy);
2627

2728
const providerToDisplayData: ThirdPartyProviderToDataMap = fromEntries(
2829
[...OAUTH_PROVIDERS, ...WEB3_PROVIDERS].map(p => {
@@ -89,9 +90,12 @@ export const useEnabledThirdPartyProviders = () => {
8990
return aName.localeCompare(bName);
9091
});
9192

93+
// Filter out any Web3 strategies that are not yet known, they are not included in our types.
94+
const knownWeb3Strategies = web3FirstFactors.filter(s => web3Strategies.includes(s));
95+
9296
return {
93-
strategies: [...knownSocialProviderStrategies, ...web3FirstFactors, ...customSocialProviderStrategies],
94-
web3Strategies: [...web3FirstFactors],
97+
strategies: [...knownSocialProviderStrategies, ...knownWeb3Strategies, ...customSocialProviderStrategies],
98+
web3Strategies: knownWeb3Strategies,
9599
authenticatableOauthStrategies,
96100
strategyToDisplayData: strategyToDisplayData,
97101
providerToDisplayData: providerToDisplayData,

0 commit comments

Comments
 (0)