vocdoni / ui-components

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

Improve census fetching integration with actions that require it #167

Open elboletaire opened 3 months ago

elboletaire commented 3 months ago

Right now, most census calls are fetched only if fetchCensus is set into the ElectionProvider. Not defining this to true and trying to use features like voting (in most cases) will make the components to behave weird, or simply not work as expected.

This is an error from the developer from not setting it, but we should either warn in these situations where it's needed and it's not set, or maybe even set it ourselves when a feature requiring it is rendered.

Personally I've lost around 2h debugging this until I find out I simply forgot setting fetchCensus to the ElectionProvider component 🤦🏼. Something so simple as a warning in the console saying "fetch census not executed because fetchCensus is falsy" would have been more than enough to avoid losing 2h (it's on me since I personally did all this... but more reason to add it).