Skip to content

Commit

Permalink
fix(paginator): last page now correctly matches rex
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions committed Oct 14, 2021
1 parent 884fc90 commit dcf9898
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ export function getNextPage(links: PaginationLink[]): string | null {
const last = links.find((l) => l.rel === 'last');
if (!next || !last) return null;
const matchNext = next.uri.match(/page=([0-9]*)/);
const matchLast = next.uri.match(/page=([0-9]*)/);

const matchLast = last.uri.match(/page=([0-9]*)/);
if (!matchNext || !matchLast) return null;
if (matchNext[1] === matchLast[1]) return null;
return matchNext[1];
Expand Down

0 comments on commit dcf9898

Please sign in to comment.