dfinity / nns-dapp

The Dapp of the Internet Computer's Network Nervous System.
https://nns.ic0.app/
Other
112 stars 38 forks source link

Stop loading neurons in NnsProposals #5408

Closed dskloetd closed 1 month ago

dskloetd commented 1 month ago

Motivation

There used to be a checkbox on the NnsProposals page to only show proposals that you can vote on. This applied a filter on list_proposals to only load proposals with ballots matching your neurons. For this reason we needed to reload the proposals when your neurons changed. But we no longer have this checkbox (we have the actionable proposals tab instead) so we no longer need:

  1. load neurons in NnsProposals
  2. reload proposals when the neurons change

Changes

  1. Stop loading neurons in NnsProposals.
  2. Stop listening to definedNeuronsStore to reload proposals.

Tests

  1. With the reloading on neurons removed, the tests no longer hit the debounce, so instead we use an unresolved promise to test the skeleton cards and the spinner.
  2. Two tests were setting proposalsFiltersStore immediate after rendering the component, for no apparently reason. This was causing proposals to be reloaded, making the test more complicated. I've removed the unnecessary setting of proposalsFiltersStore.
  3. I added a separate test to test that proposals are reloaded when the proposalsFiltersStore is set.
  4. Remove a work-around which is no longer necessary from NnsProposalListPo.waitForContentLoaded.
  5. NnsProposalListPo.waitForContentLoaded was actually broken because the .waitForAbsent() calls weren't awaited. This wasn't noticed because the 1 second delay was enough for the content to load, but fixing the waitForContentLoaded method exposed that we were waiting for NnsProposalListPo on the actionable proposals page which does not have NnsProposalListPo. So I removed this wait from neurons.spec.ts and proposals.spec.ts.

Todos