Problem/Motivation

When using infinite scroll on an AJAX view with the Load More button enabled, the pager link urls end up as views/ajax after the first time the Load More button is clicked. This is an issue if you are updating the browser history using a module like Views AJAX History. It's also an issue if someone copy and pastes the link, which admittedly is unlikely but still possible.

Proposed resolution

Use a relative url similar to how the core pager does it. This is done by using the route instead of . This will produce relative urls with only the query string which will be appended to the current path in the browser.

Remaining tasks

Review Patch

User interface changes

None.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#2 views_infinite_scroll-3004487-2.patch656 bytesdrclaw

Comments

drclaw created an issue. See original summary.

drclaw’s picture

Status: Active » Needs review
StatusFileSize
new656 bytes

Here is a patch!

kaythay’s picture

Status: Needs review » Reviewed & tested by the community

Was able to replicate the issue, and can confirm that the patch works when using ajax.

jienckebd’s picture

#2 worked for me too -- thanks!

honza pobořil’s picture

Is this bug also in 1.5 or it was introduced later?

If you will not reply in a ~week I will release 1.6 from the current dev.

drclaw’s picture

Yes I discovered this issue while running version 8.x-1.5

  • drclaw authored 0562004 on 8.x-1.x
    Issue #3004487 by drclaw: Use relative pager links and avoid the views/...
honza pobořil’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.