Problem/Motivation
When we use pager there still exists a call to the parent getNextUrls() method which tries to get the next page URL from the response header:
public function getNextUrls(string $url): array {
$next_urls = [];
$headers = $this->getResponse($url)->getHeader('Link');
if (!empty($headers)) {
$headers = explode(',', $headers[0]);
foreach ($headers as $header) {
$matches = [];
preg_match('/^<(.*)>; rel="next"$/', trim($header), $matches);
if (!empty($matches) && !empty($matches[1])) {
$next_urls[] = $matches[1];
}
}
}
return array_merge(parent::getNextUrls($url), $next_urls);
}
It adds an additional request that looks unneeded when the pager is used.
As I understand it's made for BC reasons. The code was used before the pager was added.
Proposed resolution
When some pager is selected prevent the parent method call because in that case, it is unneeded. Use it only if the pager is not selected.
Comments
Comment #2
init90Comment #3
init90Comment #4
init90Comment #6
heddnI can't tell if the lack of a call to parent will break anyone. I wouldn't think it would, but that's the sticky thing here.
Comment #8
heddnI'm going to merge this anyway. We can always revert it pretty easily if it causes issues. And performance fixes are a thing too.