Skip to content

Commit eb983ad

Browse files
committed
fix ranomise on every render
1 parent 9712cb1 commit eb983ad

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

client/app/components/vote/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ const Vote = ({ logout }: { logout: () => void }) => {
4242
if (wsData?.status === "finished") refetchElected();
4343
}, [wsData?.status]);
4444

45-
randomize(candidates);
45+
const randomizeCandidates = [...candidates];
46+
randomize(randomizeCandidates);
4647

4748
return (
4849
<>
@@ -125,7 +126,7 @@ const Vote = ({ logout }: { logout: () => void }) => {
125126
race_id={currentRace.race.id}
126127
status={currentRace.race.status}
127128
position={currentRace?.positions?.title!}
128-
candidates={candidates}
129+
candidates={randomizeCandidates}
129130
/>
130131
) : (
131132
<div className="fixed bottom-0 left-0 flex justify-center w-full p-2 cursor-pointer bg-background border-t-1 border-t-border">

0 commit comments

Comments
 (0)