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.
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.