@@ -117,15 +117,12 @@ class TransferStore {
117117
118118 try {
119119 const raw = await TransferSource . getExecutions ( transferId , {
120- limit : this . executionsPageSize + 1 ,
120+ limit : this . executionsPageSize ,
121121 } ) ;
122- const hasOlderPage = raw . length > this . executionsPageSize ;
123- const executions = hasOlderPage
124- ? raw . slice ( 0 , this . executionsPageSize )
125- : raw ;
126- TransferSourceUtils . sortExecutions ( executions ) ;
122+ const hasOlderPage = raw . length === this . executionsPageSize ;
123+ TransferSourceUtils . sortExecutions ( raw ) ;
127124 runInAction ( ( ) => {
128- this . executionsList = executions ;
125+ this . executionsList = raw ;
129126 this . executionsHasOlderPage = hasOlderPage ;
130127 this . executionsLoading = false ;
131128 } ) ;
@@ -152,21 +149,20 @@ class TransferStore {
152149
153150 try {
154151 const raw = await TransferSource . getExecutions ( transferId , {
155- limit : this . executionsPageSize + 1 ,
152+ limit : this . executionsPageSize ,
156153 marker,
154+ quietError : true ,
157155 } ) ;
158- const hasOlderPage = raw . length > this . executionsPageSize ;
159- const executions = hasOlderPage
160- ? raw . slice ( 0 , this . executionsPageSize )
161- : raw ;
162- TransferSourceUtils . sortExecutions ( executions ) ;
156+ const hasOlderPage = raw . length === this . executionsPageSize ;
157+ TransferSourceUtils . sortExecutions ( raw ) ;
163158 runInAction ( ( ) => {
164- this . executionsList = [ ...executions , ...this . executionsList ] ;
159+ this . executionsList = [ ...raw , ...this . executionsList ] ;
165160 this . executionsHasOlderPage = hasOlderPage ;
166161 this . executionsLoading = false ;
167162 } ) ;
168163 } catch ( err ) {
169164 runInAction ( ( ) => {
165+ this . executionsHasOlderPage = false ;
170166 this . executionsLoading = false ;
171167 } ) ;
172168 console . error ( err ) ;
@@ -197,21 +193,35 @@ class TransferStore {
197193 this . loading = true ;
198194 }
199195
196+ const marker = this . transferPageMarkers [ this . transfersPage - 1 ] ?? null ;
197+ const isPaginationRequest = marker !== null ;
198+
200199 try {
201- const marker = this . transferPageMarkers [ this . transfersPage - 1 ] ?? null ;
202200 const raw = await TransferSource . getTransfers ( {
203201 skipLog : options ?. skipLog ,
204- quietError : options ?. quietError ,
205- limit : this . transfersItemsPerPage + 1 ,
202+ quietError : options ?. quietError || isPaginationRequest ,
203+ limit : this . transfersItemsPerPage ,
206204 marker,
207205 } ) ;
208- const hasNextPage = raw . length > this . transfersItemsPerPage ;
209- const transfers = hasNextPage
210- ? raw . slice ( 0 , this . transfersItemsPerPage )
211- : raw ;
212- const nextMarker =
213- transfers . length > 0 ? transfers [ transfers . length - 1 ] . id : null ;
214- this . getTransfersSuccess ( transfers , hasNextPage , nextMarker ) ;
206+ if ( isPaginationRequest && raw . length === 0 ) {
207+ runInAction ( ( ) => {
208+ this . transfersHasNextPage = false ;
209+ this . transfersPage = Math . max ( 1 , this . transfersPage - 1 ) ;
210+ } ) ;
211+ return ;
212+ }
213+ const hasNextPage = raw . length === this . transfersItemsPerPage ;
214+ const nextMarker = raw . length > 0 ? raw [ raw . length - 1 ] . id : null ;
215+ this . getTransfersSuccess ( raw , hasNextPage , nextMarker ) ;
216+ } catch ( err ) {
217+ if ( isPaginationRequest ) {
218+ runInAction ( ( ) => {
219+ this . transfersHasNextPage = false ;
220+ this . transfersPage = Math . max ( 1 , this . transfersPage - 1 ) ;
221+ } ) ;
222+ return ;
223+ }
224+ throw err ;
215225 } finally {
216226 this . getTransfersDone ( ) ;
217227 }
0 commit comments