web icon indicating copy to clipboard operation
web copied to clipboard

[Spike] Granular market data polling

Open gomesalexandre opened this issue 10 months ago • 0 comments

Overview

Following discussion with @reallybeard, this is an eng. spike on whether or not we can and should do this.

For performance reasons, we stopped polling market data often and now neve repoll at RTK level. We now have a react-query wrapper polling once every 15 minutes instead (https://github.com/shapeshift/web/pull/5803).

However, following https://github.com/shapeshift/web/pull/6654 we would like to try and have market data refetching, first isolated to the new mobile home, so we can assess whether that's sane and not a performance bottleneck.

The PoC will be extremely quick to implement - i.e just consume the hook there, and if we're happy with this we'll be able to bring this to more places where having fresh market data improves the UX.

RTK endpoints

  • findAll() only fires once and uses cached data from there on
  • findByAssetIds() similarly fires once and uses cached data

Wrapper react-query

The wrapper marketData refetches hollistic market data i.e price history and market data (note, not a findAll() call but findbyAssetIds() on all portfolio AssetIds once every 15 minutes.

References and additional details

https://github.com/shapeshift/web/pull/5803

Acceptance Criteria

  • We consume useFindByAssetIdsQuery in the mobile home page with a sane polling (e.g 2mn) on the rendered assets (either watchlist or top 10 assets)
  • Performance isn't affected by this and we're happy (or not) to bring this to more places

Need By Date

No response

Screenshots/Mockups

No response

Estimated effort

1 hour

gomesalexandre avatar Apr 10 '24 17:04 gomesalexandre