fix(dapp): pre-select the clicked token on Transfer - #72
Conversation
A balances row's "Send →" opened Transfer but always defaulted to the first token in the list rather than the one clicked. Thread the chosen token address from the balances row through App into TransferPage, which now pre-selects the matching token (falling back to the first token when opened via plain sidebar navigation). Closes #66
There was a problem hiding this comment.
Code Review
This pull request implements a feature to pre-select a token on the Transfer page when navigating from the Balances page via the "Send →" button. Feedback on the changes highlights a performance issue in TransferPage.tsx, where including preselectTokenAddress in the main data-fetching useEffect dependency array causes redundant network requests and UI flashes. The reviewer suggests decoupling the pre-selection logic into a separate, lightweight useEffect and reverting the dependency array to only depend on address.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Address review feedback: reading preselectTokenAddress inside the main token-fetch effect's dependency array refetched the whole token list and balances whenever it changed. Capture it in a ref (it's fixed for the page's lifetime) and read it inside the async load, so deps stay [address] and a pre-selection no longer triggers a refetch or loading flash. Also stop tracking .claude/ (accidental scheduled_tasks.lock) and ignore it.
salindne
left a comment
There was a problem hiding this comment.
fix seems correct, the perf concern from gemini was addressed in a cleaner way than gemini proposed
Summary
Clicking Send → on a balances row opened the Transfer tab but always defaulted to the first token in the list, not the one the user clicked. Now the clicked token is pre-selected.
Changes
DashboardBalancesPage: newonSendToken(tokenAddress)prop; the row's Send → passestoken.addressinstead of a bare tab switch.App: holds atransferTokenaddress;handleSendTokensets it then opens Transfer, while plain sidebar nav (handleTabChange) clears it so Transfer still defaults to the first token when reached normally. Cleared on disconnect.TransferPage: new optionalpreselectTokenAddress; on load selects the matching token (case-insensitive), falling back tolist[0].Test
npm run lint✅ andnpm run build✅ (packages/dapp).Closes #66