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: Pool performance data to batches. Per-page fetching, pool join subset. #2057

Merged
merged 42 commits into from
Apr 4, 2024

Conversation

rossbulat
Copy link
Collaborator

@rossbulat rossbulat commented Apr 3, 2024

This PR improves the fetching of pool performance data, and optimises pool joining UX. Prior to this PR, the app fetched performance data for every bonded pool. This was extremely useful to have as performance data was lacking ecosystem wide, but it came at a severe cost of consuming resources and slowing the app down on initialisation.

This PR now allows pool performance data to be fetched in small batches - a batch is fetched per page when the All Pools tab is visited, as well as a small batch when users click Join Pool. There are numerous other improvements in this PR that are documented below.

Breakdown of Changes

  • Allows pool performance data to be fetched in batches, rather than fetching for all pools on app initialisation, dramatically improving performance on app load.
    A new JoinPoolsProvider has been introduced, that stores a small subset of active bonded pools that are used as a "pool" of pools to join for new stakers. This is prepared on app initialisation, but no performance data is fetched until users explicitly want to join a pool.
  • Defaults have been assigned to the filter context so the pool list does not have to re-render again after mounting to apply those filters.
  • Introduces a "Finding Pools to Join" state to the Join Pool button, with animated loader and percentage completed. This state is present when pool performance data is being fetched prior to the JoinPool canvas being accessible.
  • The pool list active tab has been persisted to the BondedPools context, so it is remembered on subsequent pool list visits.
  • PoolList optimisations to prevent re-renders.
  • Pool performance chart in JoinPool canvas is now a line graph, more accurately representing their performance trend.
  • Adds a pulse animation to the Join Pool button when the JoinPool canvas is ready.
  • The PoolPerformance context has been revamped to host "tasks" metadata for each pool performance batch being processed. Refs have been used within the context to ensure the correct state is being used for updates. Improved type interfaces have been introduced making the structures easier to understand.
  • The poolPerformance worker now accumulates era points where pools have backed multiple validators.
  • JoinPool canvas: Ensures the same pool is not chosen again when "Choose Another Pool" is selected.
  • JoinPool canvas: Now only a subset of active pools are available to join, rather than every eligible pool. This subset is randomly selected, although the pool has to be active, and those displayed need daily rewards for the last 10 eras (the entire duration of performance data range).
  • Various re-render fixes in JoinPool canvas.
  • Removes "render batch iterations" for list items, as this was no longer a useful feature.
  • listItemsPerPage default has now been removed in favour of a range of perPage consts for each list type.
  • To speed up syncing, MaxEraRewardPointsEras has been decreased from 14 to 10.
  • Theming improvements.
  • Addresses fix: Reset filters to default when switching tabs #2056

src/locale/cn/library.json Outdated Show resolved Hide resolved
src/locale/cn/library.json Outdated Show resolved Hide resolved
src/locale/cn/library.json Outdated Show resolved Hide resolved
src/locale/cn/library.json Outdated Show resolved Hide resolved
@rossbulat rossbulat merged commit 965d3e1 into main Apr 4, 2024
11 checks passed
@rossbulat rossbulat deleted the rb-bactch-pool-performance branch April 4, 2024 08:14
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.

2 participants