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

Cache new asset price points #3408

Closed
wants to merge 1 commit into from
Closed

Conversation

jagodarybacka
Copy link
Contributor

@jagodarybacka jagodarybacka commented May 25, 2023

Resolves #3406

It's working but very ugly approach right now 🤢 will think about something better

What

If we are using a function that will trigger fetching new prices for assets then these prices should be cached.
Let's try dispatching newPricePoint on demand with these new prices.

Latest build: extension-builds-3408 (as of Thu, 25 May 2023 14:28:21 GMT).

If we are using function that will trigger fetching new prices for assets
then these prices should be cached.
Lets try dispatching `newPricePoint` on demand with these new prices.
@jagodarybacka jagodarybacka requested a review from Shadowfiend May 25, 2023 14:25
@jagodarybacka jagodarybacka self-assigned this May 25, 2023
@Shadowfiend
Copy link
Contributor

To approach the “something” better here, wanted to suggest a quick thought: right now, we generate the buy and sell currency amounts alongside the regular lookup of the quote.

Instead of doing that, we could calculate buy and sell currency amounts live in the swap component based on selected data from the redux store. Then, when we generate the quote, we trigger a request to get up-to-date price data to either the indexing service or the asset slice. Then the indexing service/asset slice is in charge of inspecting whether the price data that is currently available is recent enough, and trigger a lookup if not. Once the lookup completes and that data is available, the price info would display (since we'd be using a selector that would trigger immediately).

What this doesn't let us do is show a loading spinner while the price data resolves, so there's more to ponder there.

Base automatically changed from swap-tx-redesign to main May 26, 2023 11:15
@mhluongo
Copy link
Contributor

mhluongo commented Dec 7, 2024

Closing as stale

@mhluongo mhluongo closed this Dec 7, 2024
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.

Missing $ price on swap transaction screen
3 participants