diff --git a/packages/grant-explorer/src/features/round/ViewCartPage/RoundInCart.tsx b/packages/grant-explorer/src/features/round/ViewCartPage/RoundInCart.tsx index 9b90841b3a..bc1c7ea2e3 100644 --- a/packages/grant-explorer/src/features/round/ViewCartPage/RoundInCart.tsx +++ b/packages/grant-explorer/src/features/round/ViewCartPage/RoundInCart.tsx @@ -3,6 +3,7 @@ import { CartProject, VotingToken } from "../../api/types"; import { useRoundById } from "../../../context/RoundContext"; import { ProjectInCart } from "./ProjectInCart"; import { + DISABLED_CHAINS_FOR_ESTIMATES, matchingEstimatesToText, useMatchingEstimates, } from "../../../hooks/matchingEstimate"; @@ -36,7 +37,7 @@ export function RoundInCart( ); const { - data: matchingEstimates, + data, error: matchingEstimateError, isLoading: matchingEstimateLoading, } = useMatchingEstimates([ @@ -58,6 +59,11 @@ export function RoundInCart( }, ]); + const matchingEstimates = DISABLED_CHAINS_FOR_ESTIMATES.includes( + props.roundCart[0]?.chainId + ) + ? undefined + : data; const estimateText = matchingEstimatesToText(matchingEstimates); const { passportColor } = usePassport({ diff --git a/packages/grant-explorer/src/hooks/matchingEstimate.ts b/packages/grant-explorer/src/hooks/matchingEstimate.ts index 34caa2eb6f..40c29ec07d 100644 --- a/packages/grant-explorer/src/hooks/matchingEstimate.ts +++ b/packages/grant-explorer/src/hooks/matchingEstimate.ts @@ -64,6 +64,8 @@ function getMatchingEstimates( ).then((r) => r.json()); } +export const DISABLED_CHAINS_FOR_ESTIMATES = [ChainId.POLYGON]; + /** * Fetches matching estimates for the given rounds, given potential votes, as an array * For a single round, pass in an array with a single element @@ -71,7 +73,13 @@ function getMatchingEstimates( export function useMatchingEstimates(params: UseMatchingEstimatesParams[]) { const shouldFetch = params.every((param) => param.roundId !== zeroAddress); return useSWRImmutable(shouldFetch ? params : null, (params) => - Promise.all(params.map((params) => getMatchingEstimates(params))) + Promise.all( + params + .filter( + (param) => !DISABLED_CHAINS_FOR_ESTIMATES.includes(param.chainId) + ) + .map((params) => getMatchingEstimates(params)) + ) ); }