Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

Fix mismatched votes on poll with edited options (#189)

Luke Vellad7043891fa37
diff --git a/src/components/poll/mobile-poll.tsx b/src/components/poll/mobile-poll.tsx
index 9cbf59c72..91ceaff2b 100644
--- a/src/components/poll/mobile-poll.tsx
+++ b/src/components/poll/mobile-poll.tsx
@@ -45,6 +45,7 @@ const MobilePoll: React.VoidFunctionComponent = () => {
setTargetTimeZone,
getParticipantById,
optionIds,
+ getVote,
} = pollContext;
const { participants } = useParticipants();
@@ -211,9 +212,9 @@ const MobilePoll: React.VoidFunctionComponent = () => {
setIsEditing(true);
reset({
name: selectedParticipant.name,
- votes: selectedParticipant.votes.map((vote) => ({
- optionId: vote.optionId,
- type: vote.type,
+ votes: optionIds.map((optionId) => ({
+ optionId,
+ type: getVote(selectedParticipant.id, optionId),
})),
});
}}