fix for local storage on governance

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2026-02-19 16:38:10 +03:00
parent 1052bced83
commit a176a16aaf
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
4 changed files with 10 additions and 7 deletions

View File

@ -1,7 +1,7 @@
{
"name": "ghost-dao-interface",
"private": true,
"version": "0.5.22",
"version": "0.5.23",
"type": "module",
"scripts": {
"dev": "vite",

View File

@ -43,7 +43,7 @@ const NewProposal = ({ config, address, connect, chainId }) => {
const theme = useTheme();
const myStoredProposals = localStorage.getItem(MY_PROPOSALS_PREFIX);
const myStoredProposals = localStorage.getItem(`${MY_PROPOSALS_PREFIX}-${address}`);
const [myProposals, setMyProposals] = useState(
myStoredProposals ? JSON.parse(myStoredProposals).map(id => BigInt(id)) : []
);
@ -63,7 +63,7 @@ const NewProposal = ({ config, address, connect, chainId }) => {
useEffect(() => {
const toStore = JSON.stringify(myProposals.map(id => id.toString()));
localStorage.setItem(MY_PROPOSALS_PREFIX, toStore);
localStorage.setItem(`${MY_PROPOSALS_PREFIX}-${address}`, toStore);
}, [myProposals]);
useEffect(() => {

View File

@ -168,8 +168,11 @@ const ProposalDetails = ({ chainId, address, connect, config }) => {
const result = await castVote(chainId, address, proposalId, support);
if (result) {
const toStore = JSON.stringify(proposalId.toString());
localStorage.setItem(VOTED_PROPOSALS_PREFIX, toStore);
const storedVotedProposals = localStorage.getItem(`${VOTED_PROPOSALS_PREFIX}-${address}`);
const proposals = JSON.parse(storedVotedProposals || "[]").map(id => BigInt(id));
proposals.push(proposalId);
const toStore = JSON.stringify(proposals.map(id => id.toString()));
localStorage.setItem(`${VOTED_PROPOSALS_PREFIX}-${address}`, toStore);
}
setIsPending(true);

View File

@ -52,12 +52,12 @@ const ProposalsList = ({ chainId, address, config }) => {
const [proposalsFilter, setProposalFilter] = useState("active");
const myStoredProposals = localStorage.getItem(MY_PROPOSALS_PREFIX);
const myStoredProposals = localStorage.getItem(`${MY_PROPOSALS_PREFIX}-${address}`);
const [myProposals, setMyProposals] = useState(
myStoredProposals ? JSON.parse(myStoredProposals).map(id => BigInt(id)) : []
);
const storedVotedProposals = localStorage.getItem(VOTED_PROPOSALS_PREFIX);
const storedVotedProposals = localStorage.getItem(`${VOTED_PROPOSALS_PREFIX}-${address}`);
const [votedProposals, setVotedProposals] = useState(
storedVotedProposals ? JSON.parse(storedVotedProposals).map(id => BigInt(id)) : []
);