Problem/Motivation

Since #3252577: Stops loading after X amount of items(Drupal ^9.2.0 ), views_infinite_scroll uses the new once library from core.
But ajax_view.js only started using it in Drupal 9.3: https://git.drupalcode.org/project/drupal/-/commit/8a40e42714a5e7df25a3a...

Steps to reproduce

  1. Install Drupal 9.2.9
  2. Install views_infinite_scroll 2.0.0
  3. Create an AJAX view with views_infinite_scroll and several pages
  4. The first click on the views_infinite_scroll button uses AJAX, but the next click does not.

Proposed resolution

The dependency should be adjusted here.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

prudloff created an issue. See original summary.

neslee canil pinto’s picture

Version: 2.0.0 » 2.0.x-dev
Status: Active » Fixed

@prudloff not sure what you meant here, this has been already fixed and 2.x branch works well with 9.2 and above.

prudloff’s picture

The change (ajax_view.js switching to the new once library) was introduced in Drupal 9.3. Drupal 9.2 still uses the old jquery.once library.
So by using this new library, views_infinite_scroll 2.0 breaks compatibility with Drupal 9.2 and is only compatible with Drupal >=9.3, not 9.2 and above as you said.
This means the dependency declared in views_infinite_scroll.info.yml is not correct.

prudloff’s picture

Status: Fixed » Needs review
camslice’s picture

FYI this is still broken in Drupal 9.3

I can click "Load more" the first time and it successfully updates the view items using Ajax. However the second time the Ajax fails and the page reloads. There are no errors in my Javascript console and I have no other copies/override of infinite-scroll.js in my theme.

Drupal v9.3.7
views_infinite_scroll v2.0

camslice’s picture

Apologies, I can confirm that this is fixed in Drupal 9.3

However you need to clear ALL OF THE CACHES:

  • Browser
  • Application
  • Varnish
herved’s picture

Hi, just wanted to mention that I'm having the same issue with views_infinite_scroll 2.0.0 and Drupal 9.2.x.
I downgraded to 1.9.0 for now.

cfbauer’s picture

I am experiencing the issue as well, Drupal 9.3.6. Clicking on "Load more" works the first time but not the second. ?page=2 gets appended to the url.

I was wrong, updating to 2.0.x-dev fixes is the issue.

Greenman77’s picture

Likewise here, one of my sites is 9.3.2 and was running 2.0 infinite scroll would work once to get one page of items and then stop. No javascript errors to speak of.

I then added the dev fix as cfbauer has mentioned above and it's working again. Hopefully, the patch can be rolled into the next minor update.

Thanks.

hikkypo’s picture

I also have this loading issue with drupal 9.2.7 and version 2.0 of infinite scroll. Downgrading to 1.9 fixed this issue.

neslee canil pinto’s picture

@cfbauer the dev version and latest release have got the same codebase, nothing was pushed after that to the dev version. Can you tell me what you did? So I can provide a new release with some more bug fixes in it.

cfbauer’s picture

@Neslee -- Apologies for not being more clear. It looks like we were running 1.8 before updating to 2.0.x-dev. Would that explain it?

neslee canil pinto’s picture

@cfbauer ha okay got it, will include this changes in next release and update you here.

prudloff’s picture

Status: Needs review » Closed (outdated)

views_infinite_scroll does not support Drupal 9 anymore.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.