mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-29 18:26:34 +02:00
🐛 Fix crash when options change mid voting (#1239)
This commit is contained in:
parent
02f7c3ac06
commit
7e2ffd8d2b
2 changed files with 8 additions and 6 deletions
|
@ -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"
|
||||
>
|
||||
<VoteSelector
|
||||
value={field.value.type}
|
||||
value={field.value?.type}
|
||||
onChange={(vote) => {
|
||||
field.onChange({ optionId, type: vote });
|
||||
}}
|
||||
|
|
|
@ -24,10 +24,12 @@ const formSchema = z.object({
|
|||
mode: z.enum(["new", "edit", "view"]),
|
||||
participantId: z.string().optional(),
|
||||
votes: z.array(
|
||||
z.object({
|
||||
z
|
||||
.object({
|
||||
optionId: z.string(),
|
||||
type: z.enum(["yes", "no", "ifNeedBe"]).optional(),
|
||||
}),
|
||||
})
|
||||
.optional(),
|
||||
),
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue