From 4101cbdab2e4885398519e25c814b178073cdadc Mon Sep 17 00:00:00 2001 From: Megha-Dev-19 <100185149+Megha-Dev-19@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:24:27 +0530 Subject: [PATCH] minor fixes --- .../widget/pages/settings/Thresholds.jsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/instances/treasury-devdao.near/widget/pages/settings/Thresholds.jsx b/instances/treasury-devdao.near/widget/pages/settings/Thresholds.jsx index f4e4a834..a6ed9009 100644 --- a/instances/treasury-devdao.near/widget/pages/settings/Thresholds.jsx +++ b/instances/treasury-devdao.near/widget/pages/settings/Thresholds.jsx @@ -34,7 +34,7 @@ const hasCreatePermission = hasPermission( ); useEffect(() => { - if (Array.isArray(rolesData) && rolesData.length && !selectedGroup) { + if (Array.isArray(rolesData) && rolesData.length) { setSelectedGroup(rolesData[0]); } }, [rolesData]); @@ -60,6 +60,7 @@ function getLastProposalId() { } useEffect(() => { + setRolesData([]); getRoleWiseData(treasuryDaoID).then((resp) => { setRolesData(resp); }); @@ -76,11 +77,16 @@ function checkProposalStatus(proposalId) { Near.asyncView(treasuryDaoID, "get_proposal", { id: proposalId, }).then((result) => { - if (result.status === "Approved") { - setRefreshData(!refreshData); + if (Object.keys(result.votes).length === 1) { + if (result.status === "Approved") { + setRefreshData(!refreshData); + } + setToastStatus(result.status); + setVoteProposalId(proposalId); + setTxnCreated(false); + } else { + setTimeout(() => checkProposalStatus(proposalId), 1000); } - setToastStatus(result.status); - setVoteProposalId(proposalId); }); }