File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -783,10 +783,31 @@ export class DataLayer {
783783 chainId : number ;
784784 roundId : string ;
785785 } ) : 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+ }
788809
789- return response . applications ;
810+ return allApplications ;
790811 }
791812
792813 async getDonationsByDonorAddress ( args : {
Original file line number Diff line number Diff line change @@ -244,9 +244,16 @@ export const getApprovedApplicationsByProjectIds = gql`
244244` ;
245245
246246export 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+ ) {
248253 applications(
249254 where: { roundId: { _eq: $roundId }, chainId: { _eq: $chainId } }
255+ limit: $limit
256+ offset: $offset
250257 ) {
251258 id
252259 projectId
You can’t perform that action at this time.
0 commit comments