File tree Expand file tree Collapse file tree 2 files changed +32
-4
lines changed Expand file tree Collapse file tree 2 files changed +32
-4
lines changed Original file line number Diff line number Diff line change @@ -783,10 +783,31 @@ export class DataLayer {
783
783
chainId : number ;
784
784
roundId : string ;
785
785
} ) : Promise < ProjectApplicationForManager [ ] > {
786
- const response : { applications : ProjectApplicationForManager [ ] } =
787
- await request ( this . gsIndexerEndpoint , getApplicationsForManager , args ) ;
786
+ const PAGE_SIZE = 200 ; // You can adjust this value based on your needs
787
+ let allApplications : ProjectApplicationForManager [ ] = [ ] ;
788
+ let offset = 0 ;
789
+ let hasMore = true ;
790
+
791
+ while ( hasMore ) {
792
+ const response : { applications : ProjectApplicationForManager [ ] } =
793
+ await request ( this . gsIndexerEndpoint , getApplicationsForManager , {
794
+ ...args ,
795
+ limit : PAGE_SIZE ,
796
+ offset,
797
+ } ) ;
798
+
799
+ const applications = response . applications ;
800
+ allApplications = [ ...allApplications , ...applications ] ;
801
+
802
+ // If we got fewer results than the page size, we've reached the end
803
+ if ( applications . length < PAGE_SIZE ) {
804
+ hasMore = false ;
805
+ } else {
806
+ offset += PAGE_SIZE ;
807
+ }
808
+ }
788
809
789
- return response . applications ;
810
+ return allApplications ;
790
811
}
791
812
792
813
async getDonationsByDonorAddress ( args : {
Original file line number Diff line number Diff line change @@ -244,9 +244,16 @@ export const getApprovedApplicationsByProjectIds = gql`
244
244
` ;
245
245
246
246
export const getApplicationsForManager = gql `
247
- query getApplicationsForManager($chainId: Int!, $roundId: String!) {
247
+ query getApplicationsForManager(
248
+ $chainId: Int!
249
+ $roundId: String!
250
+ $limit: Int!
251
+ $offset: Int!
252
+ ) {
248
253
applications(
249
254
where: { roundId: { _eq: $roundId }, chainId: { _eq: $chainId } }
255
+ limit: $limit
256
+ offset: $offset
250
257
) {
251
258
id
252
259
projectId
You can’t perform that action at this time.
0 commit comments