chore: remove allDetectedTokens Earn references#30237
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
| }); | ||
|
|
||
| setLendingChainIds(validChainIds); | ||
| }, [setLendingChainIds]); |
There was a problem hiding this comment.
This is really not doing anything, other than causing the first render to call the other hooks with an empty array and then call them again on second render with an exact copy of LENDING_CHAIN_IDS.
I think both the useEffect and the useState are not necessary here.
| } | ||
| } | ||
| } | ||
| }; |
There was a problem hiding this comment.
detectTokens already sends messages to TokensController internally to add the tokens. It does not populate allDetectedTokens.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit dedd488. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Risk: Low - these are test file changes plus a simplification refactor of a polling hook. The core behavior (polling for token balances, currency rates, token rates, and token detection on lending chains) is preserved. The main change is that polling now starts immediately with Tags selected:
No other tags are warranted as the changes are isolated to the Earn/Stake domain and don't touch shared infrastructure, navigation, accounts, networks, or other feature areas. Performance Test Selection: |
|




Description
allDetectedTokenshas been deprecated and empty for a long time. We are now removing all remaining references to that piece of state since we are in the process of deprecating many assets controllers.This should not have any effect in the app, as the content of that piece of state is always empty.
Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-3197
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Changes Earn network polling behavior by removing the
TokensController.allDetectedTokens->addTokensimport path and by always triggeringdetectTokenson mount/account change, which could affect token-detection frequency and performance across lending chains.Overview
Simplifies
useEarnNetworkPollingby removing all usage of deprecatedTokensController.allDetectedTokensand the follow-upTokensController.addTokensimport flow; the hook now only triggersTokenDetectionController.detectTokens.Polling hooks are updated to use the static lending
LENDING_CHAIN_IDSlist directly (no local state), and tests are adjusted accordingly, including droppingaddTokensexpectations and removingallDetectedTokensfrom Earn hook test fixtures.Reviewed by Cursor Bugbot for commit 3d4bf79. Bugbot is set up for automated code reviews on this repo. Configure here.