Skip to content

[fix] Prevent balance from being fetched twice on startup#190

Open
steveluscher wants to merge 1 commit into
exiled-apes:mainfrom
steveluscher:get-balance-once-on-startup
Open

[fix] Prevent balance from being fetched twice on startup#190
steveluscher wants to merge 1 commit into
exiled-apes:mainfrom
steveluscher:get-balance-once-on-startup

Conversation

@steveluscher
Copy link
Copy Markdown

@steveluscher steveluscher commented Dec 11, 2021

Description

Right now, we fetch the wallet balance twice on startup.

This is because of the way we've configured the effect that fetches the wallet balance on startup. It re-runs whenever anything in wallet changes, even though we only need the publicKey to be able to fetch the balance.

In this pull request, we modify the dependencies array so that the only thing that can cause this effect to re-run, is a change in the publicKey.

Type of change

  • Bug fix

How Has This Been Tested?

Loaded the mint site locally, and noticed that now we only call the getBalance API once.

@steveluscher
Copy link
Copy Markdown
Author

There's a related PR in the wallet adapter repo that should help reduce re-renders of this application even more: anza-xyz/wallet-adapter#193

@jordaaash
Copy link
Copy Markdown
Contributor

That PR has been merged and released :)

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