diff --git a/apps/web/src/components/VotingCard.tsx b/apps/web/src/components/VotingCard.tsx index 1362b3e..296ac28 100644 --- a/apps/web/src/components/VotingCard.tsx +++ b/apps/web/src/components/VotingCard.tsx @@ -10,7 +10,7 @@ import { } from "@repo/ui/components/ui/card"; import { Input } from "@repo/ui/components/ui/input"; import { Skeleton } from "@repo/ui/components/ui/skeleton"; -import React, { useEffect, useState } from "react"; +import React, { useEffect, useMemo, useState } from "react"; import VotingButton from "./VotingButton"; type Project = { account: `0x${string}`; name: string }; @@ -33,6 +33,11 @@ const VotingCard = ({ maxVotedProjects?: number; isLoading: boolean; }) => { + const randomizedProjects = useMemo( + () => [...projects].sort(() => Math.random() - 0.5), + [projects], + ); + const [votes, setVotes] = useState( Object.fromEntries( projects.map((project) => [ @@ -98,7 +103,7 @@ const VotingCard = ({ - {projects.map((project) => { + {randomizedProjects.map((project) => { return (