Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-show-balance-eth-getbalance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rainbow-me/rainbowkit': patch
---

**Fix:** `useProfile` now sets an explicit `query.enabled` on the underlying `useBalance` call so that `eth_getBalance` is never requested when `showBalance` is disabled (or the account modal is closed). Previously the hook relied on passing `address: undefined` to disable the query implicitly, which could still result in a fetch in some scenarios.
5 changes: 4 additions & 1 deletion packages/rainbowkit/src/hooks/useProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export function useProfile({ address, includeBalance }: UseProfileParameters) {
const ensName = useMainnetEnsName(address);
const ensAvatar = useMainnetEnsAvatar(ensName);
const { data: balance } = useBalance({
address: includeBalance ? address : undefined,
address,
query: {
enabled: Boolean(includeBalance && address),
},
});

return { ensName, ensAvatar, balance };
Expand Down