Closed
Description
Description
When using paging, the first
and prev
links are not rendered on the second page.
Example:
First page is at URL /api/books (A), which contains a link to next page: /api/books/?page[number]=1 (B). That page contains a link to its next page: /api/books/?page[number]=2 (C).
Observed behavior:
Page C contains top-level links for first
and prev
, but they are missing on page B.
Expected behavior:
I think the correct behavior would be for first
and prev
to exist also on page B, because it is the second page.
I traced this down to LinkBuilder.SetPageLinks(...)
, which conditionally sets them:
if (_pageService.CurrentPage > 1)
{
links.First = GetPageLink(primaryResource, 1, _pageService.PageSize);
links.Prev = GetPageLink(primaryResource, _pageService.CurrentPage - 1, _pageService.PageSize);
}
I think the condition should be changed to > 0, as index 0 appears to be the first page.
Environment
latest version of Develop branch
Metadata
Metadata
Assignees
Labels
No labels