Problem
src/context/SorokitProvider.tsx manages a single error state that is overwritten by multiple async operations. In the account-loading effect (lines 52–58), getAccount and getBalances run in Promise.all and both attempt to set the same error state:
if (accountRes.error) setError(accountRes.error);
if (balancesRes.error) setError(balancesRes.error);
If both fail, the second setError silently overwrites the first. Only one error is ever visible at a time.
A second problem: error is never cleared when address changes. If wallet A caused a balance-fetch error, that error string persists in the banner while wallet B's data is loading — the user sees a stale error that no longer applies.
A third problem: disconnectWallet (line 75) clears address, account, and balances but does not clear error or reset network. A stale error from a previous session remains visible after disconnect.
Solution
Reset error to null at the start of the address-change effect, before any fetches run. Collect both errors from the Promise.all and combine them:
useEffect(() => {
setError(null); // clear stale error first
if (!address) { setAccount(null); setBalances([]); return; }
// ...
.then(([a, b]) => {
const combined = [a.error, b.error].filter(Boolean).join('; ');
if (combined) setError(combined);
});
}, [address, client]);
Also add setError(null) inside disconnectWallet.
Acceptance Criteria
Note for Contributors: If you're assigned to this issue, write a clear and detailed description for your pull request. Explain what was changed, why it was needed, how it was implemented, and include any relevant testing or screenshots where applicable.
Problem
src/context/SorokitProvider.tsxmanages a singleerrorstate that is overwritten by multiple async operations. In the account-loading effect (lines 52–58),getAccountandgetBalancesrun inPromise.alland both attempt to set the sameerrorstate:If both fail, the second
setErrorsilently overwrites the first. Only one error is ever visible at a time.A second problem:
erroris never cleared whenaddresschanges. If wallet A caused a balance-fetch error, that error string persists in the banner while wallet B's data is loading — the user sees a stale error that no longer applies.A third problem:
disconnectWallet(line 75) clearsaddress,account, andbalancesbut does not clearerroror resetnetwork. A stale error from a previous session remains visible after disconnect.Solution
Reset
errortonullat the start of the address-change effect, before any fetches run. Collect both errors from thePromise.alland combine them:Also add
setError(null)insidedisconnectWallet.Acceptance Criteria
getAccountandgetBalancesfail, the message includes both error stringsdisconnectWalletclears the error stateTopBar.tsxdoes not show stale errors after wallet switch