fix(frontend): stop perpetual Calculating on slow multihop quotes (#484) #1020

Merged
PlasticDigits merged 1 commit from fix/484-swap-calculating-hang into main 2026-07-13 10:29:20 +00:00
PlasticDigits commented 2026-07-13 09:33:32 +00:00 (Migrated from gitlab.com)

Summary

  • Fixes Swap stuck on Calculating... for slow multi-hop quotes (e.g. JADE→RUBY on Keplr Android) by skipping refetchInterval while a sim fetch is in flight (simQuoteRefetchInterval), so React Query no longer cancel/restarts quotes every 10s.
  • Swap You Receive keeps the prior amount during background refetch (shouldShowSimReceiveCalculating); submit stays blocked via #356 stale gate while isFetching.
  • Indexer getRouteSolve / postRouteSolve use a 45s timeout (prod) and accept React Query AbortSignal; Trade market shares the refetch helper.
  • Documents invariants in docs/frontend.md, new skill skills/AGENTS_FRONTEND_SWAP_QUOTE_REFETCH.md, and crosslinks from AGENTS.md / route-display skill.

Closes #484

Test plan

  • Unit: quoteDebounce.test.ts (#484 helpers), client.test.ts (route-solve timeout + AbortSignal), SwapPage.test.tsx (#356 Calculating gates still pass)
  • Prod indexer probe: JADE→RUBY amount_in=22500000 often ~20–25s / 4 hops — must complete under 45s client budget without interval cancel/restart
  • Desktop Swap: enter amount on a direct pair — receive shows amount; during 10s background refresh amount stays visible; submit briefly disabled until fetch completes
  • Desktop Swap: CW20 multihop (or JADE→RUBY on mainnet) — quote settles or shows Quote unavailable; never infinite Calculating
  • Trade market Market tab: same refetchInterval behavior with stable amount
  • (Optional) Keplr Android in-app browser: JADE → RUBY, 22.5 — Calculating clears within SLA

Follow-ups (not in this MR)

  • Indexer: tighten hybrid search / cache for distant pairs so solves are routinely <15s
  • Optional: thread AbortSignal through LCD enrich/preflight fan-out
## Summary - Fixes Swap stuck on **Calculating...** for slow multi-hop quotes (e.g. JADE→RUBY on Keplr Android) by skipping `refetchInterval` while a sim fetch is in flight (`simQuoteRefetchInterval`), so React Query no longer cancel/restarts quotes every 10s. - Swap **You Receive** keeps the prior amount during background refetch (`shouldShowSimReceiveCalculating`); submit stays blocked via `#356` stale gate while `isFetching`. - Indexer `getRouteSolve` / `postRouteSolve` use a **45s** timeout (prod) and accept React Query `AbortSignal`; Trade market shares the refetch helper. - Documents invariants in `docs/frontend.md`, new skill `skills/AGENTS_FRONTEND_SWAP_QUOTE_REFETCH.md`, and crosslinks from `AGENTS.md` / route-display skill. Closes #484 ## Test plan - [ ] Unit: `quoteDebounce.test.ts` (#484 helpers), `client.test.ts` (route-solve timeout + AbortSignal), `SwapPage.test.tsx` (#356 Calculating gates still pass) - [ ] Prod indexer probe: JADE→RUBY `amount_in=22500000` often ~20–25s / 4 hops — must complete under 45s client budget without interval cancel/restart - [ ] Desktop Swap: enter amount on a direct pair — receive shows amount; during 10s background refresh amount stays visible; submit briefly disabled until fetch completes - [ ] Desktop Swap: CW20 multihop (or JADE→RUBY on mainnet) — quote settles or shows Quote unavailable; never infinite Calculating - [ ] Trade market Market tab: same refetchInterval behavior with stable amount - [ ] (Optional) Keplr Android in-app browser: JADE → RUBY, `22.5` — Calculating clears within SLA ## Follow-ups (not in this MR) - Indexer: tighten hybrid search / cache for distant pairs so solves are routinely <15s - Optional: thread AbortSignal through LCD enrich/preflight fan-out
PlasticDigits commented 2026-07-13 10:29:21 +00:00 (Migrated from gitlab.com)

mentioned in commit 6873d06cd5

mentioned in commit 6873d06cd5c3d7ced1c34c1053757cf9ea1b83c2
PlasticDigits (Migrated from gitlab.com) merged commit 6873d06cd5 into main 2026-07-13 10:29:21 +00:00
Sign in to join this conversation.
No reviewers
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!1020
No description provided.