Skip to content

fix(transaction-pay-controller): clear stale rampsQuote on fiat quote failure#9073

Merged
amitabh94 merged 6 commits into
mainfrom
fix/tpc-clear-ramps-quote-on-failure
Jun 11, 2026
Merged

fix(transaction-pay-controller): clear stale rampsQuote on fiat quote failure#9073
amitabh94 merged 6 commits into
mainfrom
fix/tpc-clear-ramps-quote-on-failure

Conversation

@amitabh94

@amitabh94 amitabh94 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Explanation

When getFiatQuotes succeeds, it sets fiatPayment.rampsQuote on transaction state. On failure, the catch block previously only logged the error and returned an empty array — it never cleared rampsQuote. If a user had a prior successful quote and a later fetch failed (network blip, provider outage, etc.), the stale rampsQuote remained on state.

On mobile, useNoPayTokenQuotesAlert gates the fiat branch on !fiatPayment?.rampsQuote, so with a stale quote present the "No quotes" alert would never fire and the error was effectively swallowed.

This PR clears fiatPayment.rampsQuote in the getFiatQuotes catch block via TransactionPayController:updateFiatPayment, mirroring the symmetric success-path behavior that sets quoteError = undefined. A unit test verifies rampsQuote is undefined after RampsController:getQuotes throws.

References

  • Related to mobile fiat quote error handling in useNoPayTokenQuotesAlert

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Small, targeted state cleanup on an existing error path in fiat quoting; behavior change is limited to failure cases and is covered by a new unit test.

Overview
When getFiatQuotes fails after logging and returning [], it now clears fiatPayment.rampsQuote via TransactionPayController:updateFiatPayment, so a prior successful ramps quote cannot linger and block fiat “no quotes” UI (e.g. mobile checks !fiatPayment?.rampsQuote).

A unit test asserts rampsQuote is undefined when RampsController:getQuotes throws; the package changelog records the fix.

Reviewed by Cursor Bugbot for commit 3ebd95c. Bugbot is set up for automated code reviews on this repo. Configure here.

… failure

When a fiat quote fetch fails, the previous successful rampsQuote was
left on fiatPayment state. This prevented useNoPayTokenQuotesAlert from
firing on mobile because its fiat branch gates on `!fiatPayment.rampsQuote`.

Clear rampsQuote via updateFiatPayment in the catch block so any
subsequent failure after a prior success surfaces the "No quotes"
alert correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
amitabh94 and others added 3 commits June 10, 2026 09:44
@matthewwalsh0 matthewwalsh0 requested review from OGPoyraz and matthewwalsh0 and removed request for matthewwalsh0 June 10, 2026 15:27
OGPoyraz
OGPoyraz previously approved these changes Jun 10, 2026
@amitabh94 amitabh94 added this pull request to the merge queue Jun 10, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 10, 2026
@amitabh94 amitabh94 added this pull request to the merge queue Jun 10, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 10, 2026
@amitabh94 amitabh94 added this pull request to the merge queue Jun 10, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 10, 2026
@amitabh94 amitabh94 enabled auto-merge June 10, 2026 20:11
…ection

The Fixed entry for #9073 ended up under [23.5.1] after main was merged
into the branch (two release commits bumped the former Unreleased section).
Move it back to [Unreleased].

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@amitabh94 amitabh94 added this pull request to the merge queue Jun 11, 2026
Merged via the queue into main with commit 0dc2f03 Jun 11, 2026
372 checks passed
@amitabh94 amitabh94 deleted the fix/tpc-clear-ramps-quote-on-failure branch June 11, 2026 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants