Skip to content
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

fix: <ConnectButton.Custom /> not displaying balance #1760

Merged
merged 6 commits into from
Feb 8, 2024

Conversation

magiziz
Copy link
Contributor

@magiziz magiziz commented Feb 8, 2024

Changes

  • <ConnectButton.Custom /> doesn't give balance back due to our showBalance context API blocking it. It's now forced to show balance.
  • With <ConnectButton /> we wait until context API gets updated and then decide whether we show the balance or not. This way we don't show balance right away, but rather wait until we get some value from the context API.

What to test

  1. Do not test <ConnectButton /> and <ConnectButton.Custom /> at the same time since it'll force call rpc balance if you use the custom one.
  2. Make sure when testing <ConnectButton.Custom /> it should show balance no matter what. Look at network tab and see that the rpc is being called.
  3. Make sure when testing with <ConnectButton /> it should work as is right now with different responsive screen sizes.

We don't want to expose another prop to our <ConnectButton.Custom /> so we'll try to use context API as much as possible here 👍

Copy link

vercel bot commented Feb 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rainbowkit-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 8, 2024 9:07pm
rainbowkit-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 8, 2024 9:07pm

}) => {
const ready = mounted && connectionStatus !== 'loading';
const unsupportedChain = chain?.unsupported ?? false;
ready && (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only thing i did here was ready && ... didn't touch any other elements of the component

@magiziz magiziz changed the title @mago/custom connect button balance fix fix: <ConnectButton.Custom /> not displaying balance Feb 8, 2024
@magiziz magiziz marked this pull request as ready for review February 8, 2024 19:10
@magiziz magiziz requested a review from a team as a code owner February 8, 2024 19:10
@magiziz magiziz linked an issue Feb 8, 2024 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] Wallet balance not working
2 participants