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

feat: market-data slice improvements #7615

Merged
merged 9 commits into from
Aug 27, 2024
Merged

Conversation

gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Aug 23, 2024

Description

This PR removes findByAssetIds and findPriceHistoryByAssetIds endpoints in profit of findByAssetId and findPriceHistoryByAssetId.

This ensures:

  • better ergonomics (i.e many many places we were passing an array of single AssetId)
  • most importantly, better performance. See Infinite loop on buy-crypto route #7599, which, while it is an extreme case, would've been somehow mitigated to some extent by leveraging the caching of previous market-data RTK queries.
    The reason is RTK query args are shallow compared, and having the same AssetId in different assetIds[] args between runs means market-data will be refetched. By fetching one vs. many, we avoid this and ensure caching works as it should.

Issue (if applicable)

N/A, though relates to the closed #7599

Risk

High Risk PRs Require 2 approvals

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

Low, but effectively medium given the surface area. See testing steps.

Testing

Ensure market-data is happy across the app:

  • Dashboard
  • Assets Page
  • Asset Page
  • Account Asset Page
  • Swapper
  • Fiat ramps
  • DeFi, Lending, LP, RFOX

Engineering

  • ^

Operations

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

Screenshots (if applicable)

https://jam.dev/c/464026f7-308e-4061-b94a-b1cd54a609f3

Base automatically changed from fix_fiat_ramps_perf to develop August 25, 2024 22:29
@gomesalexandre gomesalexandre marked this pull request as ready for review August 27, 2024 05:29
@gomesalexandre gomesalexandre requested a review from a team as a code owner August 27, 2024 05:29
Copy link
Collaborator

@NeOMakinG NeOMakinG left a comment

Choose a reason for hiding this comment

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

Looks good so far!

Copy link
Collaborator

@NeOMakinG NeOMakinG left a comment

Choose a reason for hiding this comment

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

https://jam.dev/c/1b765ee4-5c79-44e1-9107-c64dd3ffb685

Couldn't find any regression, nice job!

@gomesalexandre gomesalexandre force-pushed the fix_fiat_ramps_perf_2 branch 3 times, most recently from 64a401c to 3fc4c2e Compare August 27, 2024 09:30
@gomesalexandre gomesalexandre enabled auto-merge (squash) August 27, 2024 09:31
@gomesalexandre gomesalexandre merged commit d72c8d4 into develop Aug 27, 2024
3 checks passed
@gomesalexandre gomesalexandre deleted the fix_fiat_ramps_perf_2 branch August 27, 2024 09:38
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.

Infinite loop on buy-crypto route
2 participants