Skip to content

Pioneer: Improve proposal details loading flow#1149

Merged
mnaamani merged 1 commit intoJoystream:masterfrom
Lezek123:proposal-details-loading-time-fix
Aug 11, 2020
Merged

Pioneer: Improve proposal details loading flow#1149
mnaamani merged 1 commit intoJoystream:masterfrom
Lezek123:proposal-details-loading-time-fix

Conversation

@Lezek123
Copy link
Contributor

This PR addresses an issue with slow proposal details page loading due to the fact that api.rpc.state.getKeys used to fetch all proposal votes is taking quite a long time on the current testnet (~6s during my tests) and blocks other queries that we try to execute simultaneously.

The fix is about:

  • Starting to load votes after all the basic proposal data (title, rationale, description etc.) is loaded to prevent those queries from beeing blocked by api.rpc.state.getKeys and be able to display this data before everything else is loaded.
  • Improving the flow in useProposalSubscription to avoid executing queries twice during first load

This fixes the issue only partially, because the votes and proposal discussion will still take quite some time to load. Currently I can't think of any better way of fetching those, but perhaps this will be better optimized in Substrate 2.0 (as the new api provides a standarized way of fetching double-map entries by frist key).
The proposal state should still update after each council member vote without the need to refresh the page.

@Lezek123 Lezek123 requested a review from mnaamani August 11, 2020 06:39
@mnaamani
Copy link
Member

The improvement is noticeable and greatly improves the wait time/experience.

@mnaamani mnaamani merged commit 1c6d7e2 into Joystream:master Aug 11, 2020
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

Comments