diff --git a/README.md b/README.md index a5fb8dc6..45ef6a76 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ VeVote is a decentralized governance platform. This repository serves as the mon Ensure your development environment is set up with the following: -- **Node.js (v18 or later):** [Download here](https://nodejs.org/en/download/package-manager) ๐Ÿ“ฅ +- **Node.js (v22 or later):** [Download here](https://nodejs.org/en/download/package-manager) ๐Ÿ“ฅ - **Yarn:** [Install here](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable) ๐Ÿงถ - **Docker (for containerization):** [Get Docker](https://docs.docker.com/get-docker/) ๐Ÿณ - **Hardhat (for smart contracts):** [Getting Started with Hardhat](https://hardhat.org/hardhat-runner/docs/getting-started) โ›‘๏ธ diff --git a/apps/frontend/src/utils/proposals/helpers.ts b/apps/frontend/src/utils/proposals/helpers.ts index 0b2a9c10..e86031b4 100644 --- a/apps/frontend/src/utils/proposals/helpers.ts +++ b/apps/frontend/src/utils/proposals/helpers.ts @@ -243,8 +243,11 @@ export const parseHistoricalProposals = async ( data?: HistoricalProposalData[], ): Promise => { if (!data) return []; - const ipfsFetches = data.map(d => getProposalsFromIpfs(d.description)); + // Only fetch from IPFS if description (CID) is valid + const ipfsFetches = data.map(d => + d.description ? getProposalsFromIpfs(d.description) : Promise.resolve({ ipfsHash: undefined }), + ); const ipfsDetails = await Promise.all(ipfsFetches); return data.map(d => { diff --git a/apps/frontend/src/utils/proposals/proposalQueriesUtils.ts b/apps/frontend/src/utils/proposals/proposalQueriesUtils.ts index a388a861..5ba72ade 100644 --- a/apps/frontend/src/utils/proposals/proposalQueriesUtils.ts +++ b/apps/frontend/src/utils/proposals/proposalQueriesUtils.ts @@ -16,7 +16,10 @@ export const paginateProposals = (proposals: MergedProposal[], cursor?: string, }; export const enrichProposalsWithData = async (proposals: FromEventsToProposalsReturnType) => { - const ipfsFetches = proposals.map(p => getProposalsFromIpfs(p.ipfsHash)); + // Only fetch from IPFS if ipfsHash is valid + const ipfsFetches = proposals.map(p => + p.ipfsHash ? getProposalsFromIpfs(p.ipfsHash) : Promise.resolve({ ipfsHash: undefined }), + ); const ipfsDetails: IpfsDetails[] = await Promise.all(ipfsFetches); const mergedWithIpfs = mergeIpfsDetails(ipfsDetails, proposals);