-
Notifications
You must be signed in to change notification settings - Fork 659
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
[bug] Chains not shown for Connect Button if only one chain #1418
Comments
@hsuanweifu-sports-inference You can hide the chain drop-down like so: <ConnectButton chainStatus="none" /> |
@DanielSinclair this is not what I am asking. I want to show the chain status even if there is only one chain. Right now it will hide regard less of what you set for
See this line in the link in the original post. |
@hsuanweifu-sports-inference I see. This was an intentional design choice because users still need to choose the network via their wallet, so seeing the current network via RainbowKit is duplicative. Can you share more about the expected usecase and UX goals, and why that functionality would be better? Chain switching as a concept is largely on its way out because of WalletConnect v2 and some the modern browser extension wallets, so dApps in the near future will be able to simultaneously connect to multiple networks. |
First of all, thank you for taking the time to respond to this ticket. The goal is to have multiple environments (staging / prod) that's connected to (Testnet / Mainnet) respectively. The users will be redirected to staging (Testnet) environment if their current region is blacklisted. We want to show the current chain on the page as some wallets (such as MagicLink) do not have an interface for the user to view and change chain. |
@hsuanweifu-sports-inference If there is only "one" chain configured in your dApp can you use wagmi's switch chain hook instead ? We can help by adding a prop to But yeah if you only have one chain configured you can avoid opening the chain modal and use wagmi's switch chain hook instead which would be much simpler. Would that fix your problem? |
@hsuanweifu-sports-inference Hey just catching back here again. Any updates on this ? |
@kosmoskey I think the main issue is to show the current chain on the connect button regardless of how many chains are available. We are using The ability to switch chain is not important for this particular use case. Thank you. |
@hsuanweifu-sports-inference Thanks for this suggestion! We'll work on a prop to always show the current chain. We'll add this upstream in our new RainbowKit v2 version which launches this week. Check back soon there! |
Is this feature added to version 2? If not, please let me know how I can contribute. |
@ITZSHOAIB This is not available yet no. This is something that we'll do, but if you're interested in contributing feel free to follow this README.md. |
#1806 Should help with this |
Is there an existing issue for this?
RainbowKit Version
0.12.8
wagmi Version
0.12.8
Current Behavior
The chain button that toggles switch chains dropdown would not show if there is only one chain available.
https://github.com/rainbow-me/rainbowkit/blob/main/packages/rainbowkit/src/components/ConnectButton/ConnectButton.tsx#L71C15-L71C15
Expected Behavior
It should be a configurable option to hide the button if there is only one chain available.
Otherwise we'd need to always rely on custom connect button to show the current chain.
Steps To Reproduce
No response
Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: