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

Spike: Move opportunities to react-query #6159

Open
gomesalexandre opened this issue Feb 8, 2024 · 0 comments
Open

Spike: Move opportunities to react-query #6159

gomesalexandre opened this issue Feb 8, 2024 · 0 comments
Labels
nice to have mayyyybe one day spike

Comments

@gomesalexandre
Copy link
Contributor

Overview

We currently have THORChain LP opportunities as react-queries.
These have been implemented greenfield and not abstracted the same way other opportunities are.

This PR is twofold:

  1. Move away from RTK to react-query for all opportunities, to benefit from the advanced caching, refetching, invalidation etc that react-query provides
  2. Make the THORChain LP opportunities fit the opportunities shape. This means that the opportunities slice will have to support:
  • the notion of asymmetrical or symmetrical deposits
  • the notion of automagical network rebalancing, i.e deposit asymmetrical, but the pool becomes symmetrical under the hood

Things to consider in this spike to validate whether this is viable:

  • Can we keep selection performant with reselect? Since things aren't stored in the redux store when using react-query, derivation is typically done using the select method from queries, but nothing blocks us from using reselect here - instead of selecting from the store, it will select from the return data of queries. We could potentially abstract react-query selectors away as their own domain, and use different selectors for a same query, depending on our needs
  • Can we/should we persist react-query data? According to https://tanstack.com/query/v4/docs/framework/react/plugins/persistQueryClient, this should be possible, though there may be implications here

References and additional details

Acceptance Criteria

  • We validate we can make the opportunities work without regressions using react-query
  • The current THORChain LP data now works with the opportunities abstraction

Need By Date

N/A

Screenshots/Mockups

No response

Estimated effort

No response

@gomesalexandre gomesalexandre added the nice to have mayyyybe one day label Feb 8, 2024
@twblack88 twblack88 moved this from To schedule to Spike in ShapeShift Dashboard Mar 11, 2024
@0xean 0xean moved this to Backlog in ShapeShift Dashboard Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nice to have mayyyybe one day spike
Projects
Status: Backlog
Development

No branches or pull requests

2 participants