UI/UX Updates for Voting Window#85
Conversation
| // Filter for projects the user has voted on | ||
| const userVotes = year ? getAuthUserVotes(auth.uid, year.votes) : []; | ||
| projects = projects.filter((project) => | ||
| userVotes.some((vote) => vote.project === project.key) | ||
| ); |
There was a problem hiding this comment.
Potential bug: The "My Votes" filter in renderClosedYear will crash due to undefined variables year and myVotedProjects, preventing users from viewing their votes on closed years.
-
Description: The
renderClosedYearmethod attempts to use variablesyearandmyVotedProjectswhich are not defined within its scope. This occurs when a user filters by "My Votes" on a year with closed submissions. The code first accesses an undefinedyearvariable when calculatinguserVotes. If that were fixed, it would then access an undefinedmyVotedProjectsvariable when trying to render the list. Either access will cause aReferenceError, crashing the component and preventing the page from rendering. -
Suggested fix: In
renderClosedYear, access the year object from props usingthis.props.yearinstead of the undefined local variableyear. Additionally, define themyVotedProjectsvariable using the same filtering logic found in therenderBodymethod before it is referenced.
severity: 0.9, confidence: 1.0
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
Good stuff. Thanks Seer!
UI/UX Updates for Voting Window
CHANGES MADE

Before

Changes Made
TODO