Skip to content

Commit

Permalink
Ensure for maxed lists we don't make requests for pages after one (#4138
Browse files Browse the repository at this point in the history
)

- Missing return meant we still fetched remaining pages
- This means lists are marked as busy until all pages are fetched, even though the list is displayed as maxed
  • Loading branch information
richard-cox authored Mar 4, 2020
1 parent 390cf0f commit 7593040
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ export class PaginationPageIterator<R = any, E = any> {
}, {} as PagedJetstreamResponse);
}

private handleRequests(initialResponse: JetstreamResponse<R>, action: PaginatedAction, totalPages: number, totalResults: number) {
private handleRequests(initialResponse: JetstreamResponse<R>, action: PaginatedAction, totalPages: number, totalResults: number):
Observable<[JetstreamResponse<R>, JetstreamResponse<R>[]]> {
if (totalResults > 0) {
const maxCount = action.flattenPaginationMax;
// We're maxed so only respond with the first page of results.
Expand All @@ -94,7 +95,7 @@ export class PaginationPageIterator<R = any, E = any> {
this.actionDispatcher(
new UpdatePaginationMaxedState(maxCount, totalResults, entityType, endpointType, paginationKey, forcedEntityKey)
);
of([initialResponse]);
return of([initialResponse, []]);
}
}
return combineLatest(of(initialResponse), this.getAllOtherPageRequests(totalPages));
Expand Down

0 comments on commit 7593040

Please sign in to comment.