From c02a2f2c0de05d119cbd1c306fc01342e6b54c76 Mon Sep 17 00:00:00 2001 From: brightiron Date: Mon, 7 Oct 2024 11:35:01 -0500 Subject: [PATCH] support value index fix --- src/views/Governance/Proposals/VoteDetails.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/views/Governance/Proposals/VoteDetails.tsx b/src/views/Governance/Proposals/VoteDetails.tsx index 6011819df..e6c546e1d 100644 --- a/src/views/Governance/Proposals/VoteDetails.tsx +++ b/src/views/Governance/Proposals/VoteDetails.tsx @@ -20,12 +20,15 @@ import { VoteRow } from "src/views/Governance/Proposals/VoteRow"; const tablesData = [ { id: "For", + contractValue: 1, }, { id: "Against", + contractValue: 0, }, { id: "Abstain", + contractValue: 2, }, ]; @@ -41,9 +44,11 @@ const TabPanel = (props: { children: React.ReactNode; value: number; index: numb export default function GovernanceTable() { const { id } = useParams(); const [tabIndex, setTabIndex] = useState(0); - const { data: voteData } = useGetVotes({ proposalId: id, support: tabIndex + 1 }); + const [supportValue, setSupportValue] = useState(1); + const { data: voteData } = useGetVotes({ proposalId: id, support: supportValue }); const handleTabChange = (event: React.SyntheticEvent, newIndex: number) => { + setSupportValue(tablesData[newIndex].contractValue); setTabIndex(newIndex); };