-
Notifications
You must be signed in to change notification settings - Fork 569
[REACT] Fix/unable to override chain #708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
activeChain
inThirdwebProvider
component, I found that the RPC calls are not done through the custom RPC URL provided, instead default thirdweb RPC URL is usedsupportedChains
andactiveChain
,activeChain
with 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?
uniqueBy
util function that remove duplicated element in an arraysupportedChain
andactiveChain
by removing duplicated chain (comparingchainId
)