Repository navigation
Conversation
The layout mounts the refresh control twice: the desktop button (only CSS-hidden on phones) and an item in the mobile "More actions" menu, whose content Radix unmounts when closed. Each instance kept its own "last wallet" ref and in-flight flag, so: - every open of the mobile menu started another full wallet refresh (up to 4 transaction pages + one Blockfrost lookup per transaction and per asset), on its own throttle — double the rate 266a74e set; - switching wallet while a refresh ran skipped the new wallet's load entirely (the in-flight flag returned early, the ref moved on); - the old wallet's late results overwrote the wallet-agnostic `walletAssets` / `drepInfo`, showing its assets and DRep on the new one. The refresh state now lives in src/lib/wallet-refresh.ts at module level: only a wallet switch triggers an automatic load, a second control joins the run in flight, and a run for a wallet the user has left goes stale — it stops issuing lookups and writes neither the global fields nor a cut-short transaction history. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U11V2R2X68fxeDTVdaNYT2
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The layout mounts
WalletDataLoaderWrappertwice: the desktop refresh button (CSS-hidden on phones, but still mounted) and the item in the mobile More actions menu. Radix unmounts the menu's content while it is closed. Each instance kept its ownprevWalletIdRefandfetchingTransactionsflag, which caused three bugs. #266a74e made all three worse: a refresh of a busy wallet now runs at 5 req/s, so up to ~80 s for 400 transactions.refreshWallet()returned early on the in-flight flag, but the ref had already moved to the new wallet. Its data only arrived after a manual refresh.walletAssetsanddrepInfoare not keyed by wallet. A refresh of A that finished after the switch showed A's assets (send form, balance card) and A's DRep (vote and retire buttons) on B.Fix
Refresh state now lives at module level in
src/lib/wallet-refresh.ts, so remounts don't reset it and every instance shares it:showWallet(id)is true only on a wallet switch (or the first wallet). Remounting a control does not trigger a load.run(id, task)joins a run already in flight for the same wallet, so the menu item's spinner reflects it. Runs for different wallets do not wait on each other.walletAssets/drepInfonor a cut-short transaction history. The cached one is kept, and switching back loads afresh.loadWalletis the old body, and theisStale()guards sit in front of each write to a field that isn't keyed by wallet.Behaviour changes
/addresses/undefined/and wipedwalletAssets/drepInfo.router.reload(), so module state does not cross sessions.Tests
npx tsc --noEmit: clean.npx jest src/__tests__/walletRefresh.test.ts: 10/10. Covers joining, the slot being freed after an async or sync failure, staleness on a switch, A→B→A staying stale, and an old run not freeing a newer run's slot.node scripts/run-tests.mjs: CJS 1666 passed / 2 skipped (151 suites), ESM 97 passed (11 suites).next build --webpack+check-bundle-budget.mjs: within budget. Shared JS 193.6 KB gz, page sizes unchanged (e.g./wallets/[wallet]2210.5 KB).setDrepInfo(undefined)in the no-DRep branch, is fixed.Not verified
showWallet || isRunningcondition and the store-write guards are not covered.getWalletquery resolving,appWalletis undefined. During that window A's run is not yet stale. B's own load overwrites the result afterwards.Generated by Claude Code