fix(frontend): update or load You Receive when pay token/amount changes #496

Closed
opened 2026-07-15 04:06:40 +00:00 by PlasticDigits · 6 comments
PlasticDigits commented 2026-07-15 04:06:40 +00:00 (Migrated from gitlab.com)

Summary

On Swap (and Trade market if applicable), when the user changes the pay token or pay amount, You Receive often stays on the previous quote instead of either:

  1. Updating to the new estimated receive amount as soon as a quote for the new inputs is available, or
  2. Showing loading (e.g. Calculating…) while a quote for the new inputs is in flight / not yet available.

Stale receive amounts are misleading and can look like the quote is still valid for the new pay side.

Expected

User action You Receive
Change pay amount or pay token Show Calculating… (or equivalent loading) until a quote matching the new pay inputs is ready
New quote settles for current pay inputs Show the updated receive amount
Background refresh of the same pay inputs (unchanged) Keeping the prior amount is OK (see #484)

Actual

After changing pay token and/or amount, You Receive can continue displaying the previous estimate without a clear loading state, so it appears tied to the old pay side.

Likely context

#484 intentionally keeps the prior receive amount during background refetch when simData exists (shouldShowSimReceiveCalculating → Calculating only when isFetching && !simData, plus keepPreviousData). That is correct for same-input refreshes, but for pay token/amount changes the UI should treat the prior amount as stale: either clear/loading until the new query key settles, or replace promptly when the new quote arrives.

Related: #356 (submit Calculating / stale gate), #484 (receive keep-previous on refetch).

Acceptance criteria

  • Changing pay amount clears or shows loading on You Receive until the quote for the debounced amount is ready, then shows the new amount.
  • Changing pay token does the same (no leftover receive from the previous pair).
  • Unchanged pay inputs during a background sim refetch still keep the prior receive amount (#484 invariant).
  • Submit button stale/Calculating behavior (#356) remains correct.
  • Unit coverage for the receive loading vs keep-previous distinction (e.g. quoteDebounce / Swap page tests).

How to reproduce

  1. Open Swap with a quoted pair; wait until You Receive shows an amount.
  2. Change the pay amount (or switch pay token).
  3. Observe You Receive: it should load or update for the new inputs, not leave the old number looking current.
## Summary On Swap (and Trade market if applicable), when the user changes the **pay** token or **pay** amount, **You Receive** often stays on the previous quote instead of either: 1. **Updating** to the new estimated receive amount as soon as a quote for the new inputs is available, or 2. **Showing loading** (e.g. Calculating…) while a quote for the new inputs is in flight / not yet available. Stale receive amounts are misleading and can look like the quote is still valid for the new pay side. ## Expected | User action | You Receive | |-------------|-------------| | Change pay amount or pay token | Show **Calculating…** (or equivalent loading) until a quote matching the new pay inputs is ready | | New quote settles for current pay inputs | Show the **updated** receive amount | | Background refresh of the *same* pay inputs (unchanged) | Keeping the prior amount is OK (see #484) | ## Actual After changing pay token and/or amount, You Receive can continue displaying the **previous** estimate without a clear loading state, so it appears tied to the old pay side. ## Likely context #484 intentionally keeps the prior receive amount during background refetch when `simData` exists (`shouldShowSimReceiveCalculating` → Calculating only when `isFetching && !simData`, plus `keepPreviousData`). That is correct for **same-input** refreshes, but for **pay token/amount changes** the UI should treat the prior amount as stale: either clear/loading until the new query key settles, or replace promptly when the new quote arrives. Related: #356 (submit Calculating / stale gate), #484 (receive keep-previous on refetch). ## Acceptance criteria - [ ] Changing pay **amount** clears or shows loading on You Receive until the quote for the debounced amount is ready, then shows the new amount. - [ ] Changing pay **token** does the same (no leftover receive from the previous pair). - [ ] Unchanged pay inputs during a background sim refetch still keep the prior receive amount (#484 invariant). - [ ] Submit button stale/Calculating behavior (#356) remains correct. - [ ] Unit coverage for the receive loading vs keep-previous distinction (e.g. `quoteDebounce` / Swap page tests). ## How to reproduce 1. Open Swap with a quoted pair; wait until You Receive shows an amount. 2. Change the pay amount (or switch pay token). 3. Observe You Receive: it should load or update for the new inputs, not leave the old number looking current.
PlasticDigits commented 2026-07-25 04:32:52 +00:00 (Migrated from gitlab.com)

mentioned in commit 70937b9c1f

mentioned in commit 70937b9c1ffc124db473dc594cc18406b57173dd
PlasticDigits commented 2026-07-25 04:32:58 +00:00 (Migrated from gitlab.com)

mentioned in merge request !1031

mentioned in merge request !1031
PlasticDigits commented 2026-07-25 04:45:09 +00:00 (Migrated from gitlab.com)

mentioned in commit a04bc11e22

mentioned in commit a04bc11e22df0e241c8d74967c6dc763ea7ebdd6
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-07-25 04:48:09 +00:00
PlasticDigits commented 2026-07-25 04:48:37 +00:00 (Migrated from gitlab.com)

mentioned in commit 5993d3a7e8

mentioned in commit 5993d3a7e8d72360972024222d0341ea3f920d71
PlasticDigits commented 2026-07-25 04:50:15 +00:00 (Migrated from gitlab.com)

mentioned in commit f03076c215

mentioned in commit f03076c215f8c3415241d97ee687620788c7438d
PlasticDigits commented 2026-08-26 04:08:09 +00:00 (Migrated from gitlab.com)

mentioned in issue #659

mentioned in issue #659
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic#496
No description provided.