diff --git a/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx b/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx index f67eb4b38..71277c59f 100644 --- a/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx +++ b/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx @@ -111,13 +111,13 @@ const ParticipantRowForm = ({ onClick={() => { field.onChange({ optionId, - type: toggleVote(field.value.type), + type: toggleVote(field.value?.type), }); }} className="absolute inset-0 flex cursor-pointer items-center justify-center hover:bg-gray-100 active:bg-gray-200/50 active:ring-1 active:ring-inset active:ring-gray-200" > { field.onChange({ optionId, type: vote }); }} diff --git a/apps/web/src/components/poll/voting-form.tsx b/apps/web/src/components/poll/voting-form.tsx index 6e22e8969..9ab886839 100644 --- a/apps/web/src/components/poll/voting-form.tsx +++ b/apps/web/src/components/poll/voting-form.tsx @@ -24,10 +24,12 @@ const formSchema = z.object({ mode: z.enum(["new", "edit", "view"]), participantId: z.string().optional(), votes: z.array( - z.object({ - optionId: z.string(), - type: z.enum(["yes", "no", "ifNeedBe"]).optional(), - }), + z + .object({ + optionId: z.string(), + type: z.enum(["yes", "no", "ifNeedBe"]).optional(), + }) + .optional(), ), });