From de84f8e40f1c5d30d4f77f3d010f9fd678b2e4b6 Mon Sep 17 00:00:00 2001 From: Uncle Fatso Date: Sat, 21 Feb 2026 18:25:00 +0300 Subject: [PATCH] auto update UI after any action on the detailed view Signed-off-by: Uncle Fatso --- package.json | 2 +- src/containers/Governance/ProposalDetails.jsx | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 5d67954..c8fc3db 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ghost-dao-interface", "private": true, - "version": "0.5.30", + "version": "0.5.31", "type": "module", "scripts": { "dev": "vite", diff --git a/src/containers/Governance/ProposalDetails.jsx b/src/containers/Governance/ProposalDetails.jsx index cb3dfb4..3627d56 100644 --- a/src/containers/Governance/ProposalDetails.jsx +++ b/src/containers/Governance/ProposalDetails.jsx @@ -1,7 +1,8 @@ import { useEffect, useState, useMemo } from "react"; import ReactGA from "react-ga4"; import { useParams } from 'react-router-dom'; -import { useBlock, useBlockNumber } from 'wagmi' +import { useQueryClient } from '@tanstack/react-query'; +import { useBlock, useBlockNumber } from "wagmi"; import { Box, @@ -72,6 +73,7 @@ import RepeatIcon from '@mui/icons-material/Repeat'; const HUNDRED = new DecimalBigNumber(100n, 0); + const ProposalDetails = ({ chainId, address, connect, config }) => { const { id } = useParams(); const proposalId = BigInt(id); @@ -84,6 +86,7 @@ const ProposalDetails = ({ chainId, address, connect, config }) => { const isVerySmallScreen = useMediaQuery("(max-width: 379px)"); const theme = useTheme(); + const queryClient = useQueryClient(); const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST"); const { balance } = useBalance(chainId, "GHST", address); @@ -173,20 +176,22 @@ const ProposalDetails = ({ chainId, address, connect, config }) => { proposals.push(proposalId); const toStore = JSON.stringify(proposals.map(id => id.toString())); localStorage.setItem(`${VOTED_PROPOSALS_PREFIX}-${address}`, toStore); + await queryClient.invalidateQueries(); } - setIsPending(false); } const handleExecute = async () => { setIsPending(true); await executeProposal(chainId, address, proposalId); + await queryClient.invalidateQueries(); setIsPending(false); } const handleRelease = async (proposalId) => { setIsPending(true); await releaseLocked(chainId, address, proposalId); + await queryClient.invalidateQueries(); setIsPending(false); } @@ -401,7 +406,7 @@ const VotingTimeline = ({ connect, handleExecute, handleRelease, proposalLocked, - {(isProposer || (proposalLocked?._value ?? 0n) > 0n) && 0n) && address === "" ? connect() : handleRelease()}