mirror of
https://github.com/status-im/sourcecred.git
synced 2025-01-30 06:15:47 +00:00
a133a7252f
Currently, it's possible to lock the cred explorer UI via the following sequence of actions: 1. Press the analyze cred button 2. While it is running, modify the weights After following this repro, the UI is stuck: it will say "loading" forever, and the analyze cred button is disabled. The issue is that loadGraph and runPagerank do not apply their success (or failure) state transitions if they are pre-empted by another state change. If a repo change occurs, that's the right behavior: the repo change puts the state back to `"READY_TO_LOAD_GRAPH"`, which means the UI is ready to re-load, and showing the PageRank results for the wrong repo would be very confusing. However, if an edge evaluator change occurs while loadGraph or runPagerank is happening, the state is left in the "LOADING" status (which means the analyze cred button is disabled). This commit fixes the issue via a refactor: per @wchargin's suggestion, responsibility for the edge evaluator moves from the state module out to `credExplorer/App.js`. This dramatically simplifies the state module, as we no longer need a `Substate` concept: we can simplify the state into a single sequence of states. As of the refactor, the bug is impossible. Test plan: Unit tests have been updated to maintain coverage on the refactored code. I manually tested that the bug no longer repro's, and that the cred explorer UI continues to function. I did not add a new test to protect against regression, because in the new codepath, the bug is basically impossible.