Skip to content

Commit

Permalink
before merged with json
Browse files Browse the repository at this point in the history
  • Loading branch information
aj-maz committed Oct 29, 2021
1 parent 557627a commit 63e1389
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions app/src/utils/data/contributions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export async function getContributions(

const limit = 100;

const fetchUntilAll = async (SUBGRAPH_URL: string, before = [], skip = 0): Promise<any[]> => {
const fetchUntilAll = async (SUBGRAPH_URL: string, before: any[] = [], skip = 0): Promise<any[]> => {
const res = await fetch(SUBGRAPH_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
Expand All @@ -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];
}
Expand Down

0 comments on commit 63e1389

Please sign in to comment.