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(bridge-ui): balance not updating on manual wallet connect #16312

Closed
wants to merge 1 commit into from

Conversation

CodeDragonVN
Copy link
Contributor

Issue:

I experienced a lack of balance update when manually connecting my wallet to the bridge interface. The balance should display immediately upon connection, but I saw that "Balance: N/A" remained even after a successful wallet connection. This issue did not occur when the wallet auto-connected, it was only present when I needed to click the 'Connect Wallet' button.

Connect Wallet Button

Cause:

I believe the cause is in the onNetworkChange function, which has a condition that both srcChain and destChain must be present to update the balance. This logic fails to account for cases where a user manually connects their wallet without a previous network change.

N/A Balance

Resolution:

To solve this, I modified the onNetworkChange function so the balance updates even if only the srcChain is present, which typically occurs when manually connecting a wallet. The updated logic now checks for the existence of destChain, and if absent, proceeds with undefined. The functions getTokenBalance in bridge-ui/src/libs/token/fetchBalance.ts and getAddress in bridge-ui/src/libs/token/getAddress.ts seem unaffected by these changes since they can handle an undefined value for destChainId.

@CodeDragonVN CodeDragonVN changed the title fix: balance not updating on manual wallet connect fix(bridge-ui): balance not updating on manual wallet connect Mar 4, 2024
@dantaik dantaik requested a review from KorbinianK March 5, 2024 01:03
@KorbinianK
Copy link
Contributor

@CodeDragonVN Valid bug, however not the right fix. This is more of a workaround that happens to work but not addressing the underlying issue.

OnNetwork will be removed in an upcoming release anyway and only OnNetwork remains. A fix will be added then.

Still, thanks for raising this and looking into it.

@KorbinianK KorbinianK closed this Mar 5, 2024
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.

2 participants