vocdoni / ui-components

Vocdoni UI components libs
GNU General Public License v3.0
3 stars 2 forks source link

UI gets frozen with some flows of the anonymous voting (add workers or a similar solution) #123

Closed elboletaire closed 9 months ago

elboletaire commented 9 months ago

Marked as enhancement, although it really gives a bad experience to users, so it can be considered a bug too.

Some processes block the UI for anonymous elections:

A solution could be to use web workers, but they can be tricky, since we can have issues due to the scope of the operations. I've personally tried using useWorker package, but I could not get even their example working (either because it's super out of date the package, or simply because it does not work on useEffects, where we really want it for the downloading process).

elboletaire commented 9 months ago

It also gets frozen after an anonymous vote has been emitted in a spreadsheet election... not sure why there tho, since it should not be doing anything expensive.

marcvelmer commented 9 months ago

It also gets frozen after an anonymous vote has been emitted in a spreadsheet election... not sure why there tho, since it should not be doing anything expensive.

This is because somehow the workers (which you can see in the debug tab) don't stop. Why? No idea. Sometimes stop, sometimes not.

marcvelmer commented 9 months ago

Marked as enhancement, although it really gives a bad experience to users, so it can be considered a bug too.

Some processes block the UI for anonymous elections:

* Downloading the zksnarks circuit (happens every time a user logs in to an anonymous process)

* Voting anonymous processes (at least using spreadsheet censuses, which generate wallets in the background)

A solution could be to use web workers, but they can be tricky, since we can have issues due to the scope of the operations. I've personally tried using useWorker package, but I could not get even their example working (either because it's super out of date the package, or simply because it does not work on useEffects, where we really want it for the downloading process).

Remember that maybe would be a good idea to do the submitVote with async generators, we should have a look at this.

elboletaire commented 9 months ago

Remember that maybe would be a good idea to do the submitVote with async generators, we should have a look at this.

Do you think this would improve the UX? I'm not sure it would mark a difference, other than having a nice modal with loaders like when we create a new process

marcvelmer commented 9 months ago

Remember that maybe would be a good idea to do the submitVote with async generators, we should have a look at this.

Do you think this would improve the UX? I'm not sure it would mark a difference, other than having a nice modal with loaders like when we create a new process

For sure. It will give more information using spinners, for example, and at least you will see a difference between when it's downloading the circuits or when its generating the proof. I'm talking about the UX, of course, timmings cannot be reduced in this situation.

elboletaire commented 9 months ago

Yeah but this is about the freezing of the UI, and I'm not sure it will make any difference there tbh...

elboletaire commented 9 months ago

Moving it to ui-components, since this issue belongs there.