Repository navigation
[REACT] Fix/unable to override chain - #708
Conversation
🦋 Changeset detectedLatest commit: 1459f85 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| return [...supportedChains, activeChain] as Readonly<Chain[]>; | ||
| return uniqueBy([activeChain, ...supportedChains], "chainId") as Readonly< | ||
| Chain[] | ||
| >; |
There was a problem hiding this comment.
Thanks or contributing to our repo! This is indeed an issue. What do you think if we do the following to filter out the activeChain from the supportedChains array? This way we don't need to add the uniqueBy function and can use a tested array function.
return [
...supportedChains.filter((c) => c.chainId !== activeChain.chainId),
activeChain,
] as Readonly<Chain[]>;
There was a problem hiding this comment.
@iketw Sure, makes sense to use simpler implementation. Will make the change
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #708 +/- ##
=======================================
Coverage 69.76% 69.76%
=======================================
Files 219 219
Lines 9559 9559
Branches 1154 1154
=======================================
Hits 6669 6669
Misses 2291 2291
Partials 599 599 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
Issue
activeChaininThirdwebProvidercomponent, I found that the RPC calls are not done through the custom RPC URL provided, instead default thirdweb RPC URL is usedsupportedChainsandactiveChain,activeChainwith overridden value should replace the respective chain config insupportedChain. This causes the RPC URLs mapping passed into Wagmi uses the default RPC URL.What's this PR do?
uniqueByutil function that remove duplicated element in an arraysupportedChainandactiveChainby removing duplicated chain (comparingchainId)