dappuniversity / election

A Decentralized Ethereum Voting Application Tutorial
563 stars 506 forks source link

fix same candidates appearing multiple times in table #43

Open DongsubShim opened 4 years ago

DongsubShim commented 4 years ago

Key changes:

Use Promise.all so all candidates are available for synchronous table update for each render() call. Now, for two candidates, the table update would be like: (cand1 from 1st render call + cand2 from 1st) update done for 1st render … 2nd render …

Previously, multiple render() calls mixed up promises, so the table sometimes returned strange result: (cand1 from 1st + cand1 from 2nd + cand2 from 1st + cand2 from 2nd) update done for 1st and 2nd render() calls at the same time but the table showed each candidate twice.

marcopestrin commented 3 years ago

thank you