From 63e13890ca431d487de43b8c71dfb1a1acdb9679 Mon Sep 17 00:00:00 2001 From: Ajand Mardalizad Date: Fri, 29 Oct 2021 21:23:39 +0330 Subject: [PATCH] before merged with json --- app/src/utils/constants.ts | 2 +- app/src/utils/data/contributions.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/utils/constants.ts b/app/src/utils/constants.ts index 9b030f77..c1e74a08 100644 --- a/app/src/utils/constants.ts +++ b/app/src/utils/constants.ts @@ -41,7 +41,7 @@ export const DefaultForageConfig: LocalForageConfig = { // this store should be used for any on-chain/off-chain data but never user data (as we might clear it without notice) name: 'dGrants', // we can bump this version number to bust the users cache - version: 1, + version: 3, }; // LocalForage keys diff --git a/app/src/utils/data/contributions.ts b/app/src/utils/data/contributions.ts index 6a1a00b3..20d7019b 100644 --- a/app/src/utils/data/contributions.ts +++ b/app/src/utils/data/contributions.ts @@ -56,7 +56,7 @@ export async function getContributions( const limit = 100; - const fetchUntilAll = async (SUBGRAPH_URL: string, before = [], skip = 0): Promise => { + const fetchUntilAll = async (SUBGRAPH_URL: string, before: any[] = [], skip = 0): Promise => { const res = await fetch(SUBGRAPH_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, @@ -80,7 +80,8 @@ export async function getContributions( const json = await res.json(); if (json.data.grantDonations.length) { - return await fetchUntilAll(SUBGRAPH_URL, before, skip + 1); + const current = [...before, ...json.data.grantDonation]; + return await fetchUntilAll(SUBGRAPH_URL, current, skip + 1); } else { return [...before]; }