Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dont display loading state when completed quote request has no results #7818

Merged
merged 4 commits into from
Oct 1, 2024

Conversation

woodenfurniture
Copy link
Member

@woodenfurniture woodenfurniture commented Sep 26, 2024

Description

Resolves state issue in trade UI where lack of non-errored quoted is treated as loading state, resulting in infinite spinner when all swappers failed to return a quote.

Issue (if applicable)

closes #7789

Risk

High Risk PRs Require 2 approvals

Low risk, though considering the massive usage of the swapper feature we should review it with added caution.

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

Affects quotes and loading state.

Testing

The easiest way to test this is by trying to get a quote with assets which are THOR only (e.g UTXOs, or UTXO<->ATOM would work too), and then blocking the swap* domain.
To do so, proceed as follow:

  • Try and get a first quote, which should go through
  • Then, filter network requests by thor swap. You'll notice request/s matching the swap?amount= pattern, click on any
  • Block request URL, not domain for the request
    image
  • In your list of filtered network requests, click edit, and replace everything after swap with a star:
    image
  • Ensure the next time you try and get a quote (or after auto-refetch timeout), you see the "No Rate Available" copy instead of infinite loading state previously
    image
  • You can do the same in develop/prod as a sanity check
  • ⚠️ Don't forget to remove the network request blocking after you've done testing this, or your THOR requests will be perma-rugged until you do

Engineering

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

Screenshots (if applicable)

Demo using monkey patch to force simulated thorchain swapper error:

https://jam.dev/c/39fb191a-25b1-4f15-8505-c02454b8a60a

@woodenfurniture woodenfurniture force-pushed the infinite-load-no-quotes branch 2 times, most recently from 88f9687 to 3c3ce82 Compare September 27, 2024 23:46
@woodenfurniture woodenfurniture marked this pull request as ready for review September 27, 2024 23:46
@woodenfurniture woodenfurniture requested a review from a team as a code owner September 27, 2024 23:46
Copy link
Contributor

@0xApotheosis 0xApotheosis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking tidy.

✅ Simulating no quote:

Screenshot 2024-09-30 at 12 29 22

src/state/slices/tradeQuoteSlice/selectors.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional pass - tested with ETH/BTC quote and blocked THOR quotes XHR in network, confirmed this does what it says on the box

image image image

Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some Qs to remove confusion re: discrepencies between intent/implementation, but functionally LGTM!

@woodenfurniture woodenfurniture enabled auto-merge (squash) October 1, 2024 00:56
@woodenfurniture woodenfurniture merged commit a24997f into develop Oct 1, 2024
3 checks passed
@woodenfurniture woodenfurniture deleted the infinite-load-no-quotes branch October 1, 2024 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Swapper infinite load state
3 participants