fix: prevent infinite provider alternation when all providers return empty payment methods#28586
Draft
saustrie-consensys wants to merge 2 commits intomainfrom
Draft
fix: prevent infinite provider alternation when all providers return empty payment methods#28586saustrie-consensys wants to merge 2 commits intomainfrom
saustrie-consensys wants to merge 2 commits intomainfrom
Conversation
Contributor
|
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. |
…empty payment methods When a user selects a token (e.g. SOL) that multiple providers claim to support via supportedCryptoCurrencies but none return valid payment methods, the auto-switch effect in BuildQuote cycles endlessly between providers. This tracks which providers have already been attempted for the current token so they are skipped on subsequent runs, allowing the effect to fall through to the Token Not Available modal once all candidates are exhausted. Fixes: https://consensyssoftware.atlassian.net/browse/TRAM-3435
…lash
Change the auto-switch guard from a single-attempt boolean to a Set that
tracks every provider already tried for the current token. This lets the
effect exhaust all candidates (matching the design intent of finding the
right provider for the user) while still preventing the infinite loop.
Additionally, suppress the "Powered by {provider}" text whenever
providerAutoSelected && isTokenUnavailable so the user does not see
the provider name flash as each candidate is probed.
c60ec98 to
7c5114c
Compare
Contributor
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - draft PR All E2E tests pre-selected. |
Contributor
|
✅ E2E Fixture Validation — Schema is up to date |
|
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.



Description
When a user selects a token (e.g. SOL) where multiple providers claim static support via
supportedCryptoCurrenciesbut all return empty payment methods from the API, the auto-switch effect inBuildQuoteenters an infinite loop — cycling between providers every ~370ms.What is the reason for the change? The
isTokenUnavailableeffect silently switches to the next provider that statically supports the token, but never checks whether that candidate was already tried. When all candidates fail, it cycles back to the first one endlessly.What is the improvement/solution? Track which providers have already been attempted for the current token via a ref (
triedProvidersRef). Skip already-tried providers in theproviders.find()call. Once all candidates are exhausted, fall through to the Token Not Available modal. The set resets when the token changes.Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/TRAM-3435
Manual testing steps
Screenshots/Recordings
Before
https://www.loom.com/share/ef3f1307805646478e9e6ae3aa8a088a
After
Pre-merge author checklist
Pre-merge reviewer checklist