mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-30 18:56:45 +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={() => {
|
onClick={() => {
|
||||||
field.onChange({
|
field.onChange({
|
||||||
optionId,
|
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"
|
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
|
<VoteSelector
|
||||||
value={field.value.type}
|
value={field.value?.type}
|
||||||
onChange={(vote) => {
|
onChange={(vote) => {
|
||||||
field.onChange({ optionId, type: vote });
|
field.onChange({ optionId, type: vote });
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -24,10 +24,12 @@ const formSchema = z.object({
|
||||||
mode: z.enum(["new", "edit", "view"]),
|
mode: z.enum(["new", "edit", "view"]),
|
||||||
participantId: z.string().optional(),
|
participantId: z.string().optional(),
|
||||||
votes: z.array(
|
votes: z.array(
|
||||||
z.object({
|
z
|
||||||
|
.object({
|
||||||
optionId: z.string(),
|
optionId: z.string(),
|
||||||
type: z.enum(["yes", "no", "ifNeedBe"]).optional(),
|
type: z.enum(["yes", "no", "ifNeedBe"]).optional(),
|
||||||
}),
|
})
|
||||||
|
.optional(),
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue