FIX: poll ranked choice results not showing on first vote
Currently (for Ranked Choice only) a javascript exception is raised on very first vote, preventing the results from being rendered requiring a browser refresh (which doesn't error).
Missing vote:
Resolves: TypeError: this.args.rankedChoiceOutcome.round_activity is undefined with simple addition of optional chaining operator.
This pull request has been mentioned on Discourse Meta. There might be relevant details there:
https://meta.discourse.org/t/poll-ranked-choice-first-vote-causes-exception-and-fails-to-display-on-outcome/324448/2
Ideally we would need a spec for this, do you know how to write system specs @merefield ?
@jjaffeux sure, I'm probably responsible for at least a third of the front end tests on Poll by now! 😅
No problem, coming up!
@jjaffeux done. This new test will fail without the fix and throw a global exception. If you prefer a different approach I'd be grateful if you could provide an example.
global failure: TypeError: Cannot read properties of undefined (reading 'length')