Problem/Motivation

I have a view with Masonry API and Masonry Views which shows images. Sometime during this spring, the infinite scroll has stopped working after one refresh, i.e. it fills the view with an additional 50 images, but then it stops. No more images are being loaded.

Steps to reproduce

Visit https://www.reklamfranforr.se/galleri and scroll down. The view will refresh and add 50 more images, but then nothing more.

Would appreciate some pointers on how to fix this.

Yours truly,
Adam

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

AdamEvertsson created an issue. See original summary.

neslee canil pinto’s picture

StatusFileSize
new906.78 KB

@AdamEvertsson I can see there is a console error on your page https://www.reklamfranforr.se/galleri. Which might cause the VIS module to stop working.

amit.mall’s picture

Masonry js plugin comes with own method to initialise. You can reload Masonry js method after ajax call.
$('.masonry-layout-gallery').masonry('reloadItems')
write this code inside drupal behaviour:

Drupal.behaviors.exampleModule = {
  attach: function (context, settings) {
    //your code
   $('.masonry-layout-gallery').masonry('reloadItems')
  }
};
luksak’s picture

I have the same issue, but without masonry. What I observed: the event handler on the load more link is not present after the first ajax request.

luksak’s picture

Upgrading to 2.0 fixes the issue for me.

dinazaur’s picture

+1. 2.0 Only works correctly.

lroels’s picture

+1 Works on 2.0.
Question is: shouldn't this be fixed on the 1.x version as well?
Especially since that version is still fully supported.

adamevertsson’s picture

I finally had time to test this on my site, and it works with 2.0.
Thanx everyone!

neslee canil pinto’s picture

Version: 8.x-1.9 » 8.x-1.x-dev
Status: Active » Fixed
2dareis2do’s picture

I am having similar issue and behaviour in 2.0 branch.

The error I see is

Uncaught TypeError: query is undefined

2dareis2do’s picture

StatusFileSize
new216.5 KB
yeebot’s picture

I'm also seeing this issue with 2.0.0 on my Views page. To replicate:

  • Create a view page that shows a total of 12 items.
  • Infinite Scroll Options set to NOT automatically load content and display 4 items at a time.
  • Save and observe the first 4 items appear on your page. Scroll down and click the "Load More" button to see the next 4.
  • Then click the "Load More" button one more time expecting to see the addition of the final 4 items. But instead all the previous items disappear and only the final 4 items are displayed. The URL of the page changes to show any exposed filter query strings and the query string &page=2. Removing the page query string from the URL resets the listings back to the initial display.

I'm not seeing any js errors in the console.

borg_git’s picture

Version: 8.x-1.x-dev » 2.0.0
Status: Fixed » Needs work

yeebot
I have the same problem in all versions "Views Infinite Scroll".
For now my quick solution is set Pager ID as 1,
after click the "Load More" button view update elements with ajax without page rebuild.

ma h’s picture

Update to 2.0.0 don't fix it for me. I'm on Drupal core 9.4.1

sascha_meissner’s picture

Had the same issue without masonry or extra stuff

BUT for me the Update from 1.9.0 to "^2.0" did solve the problem.

**Update**
On 9.3.x

swatidhurandhar07’s picture

^2.0 version is not working in drupal 9.4.3 as well.

trakoczi’s picture

We are using version 2.0 as well with Drupal 9.2.21 and we experience the problem too. We have a view where we display 5 items first then load 5 more via AJAX with each click on Next button. Pretty standard setup.

What I spotted is that the Next button has initially href="?page=1" on it, which loads the items no. 6-10 perfectly. But when the next button is changed at this point, it has href="?page=2%2C0%2C0%2C0%2C0" (2,,,,) on it which doesn't seem right. I tried to see what happens if I just edit the href value in Dev Tools and then click the button, but it's then no AJAX request anymore, but a page load.

UPDATE: downgrading the module to version 1.9 fixes the problem, now we can have to view scroll indeed endlessly.

masoom2206’s picture

laura.gates’s picture

Also running into this with version 2.0 of this module and Drupal 9.3.21 and using PHP 8.0. It seems like Stops loading after X amount of items(Drupal ^9.2.0 ) (3252577) may have come back to some extent.

vlyalko’s picture

I have the same problem in drupal 10, version ^2.0 and I solved it with the solution from https://www.drupal.org/project/views_infinite_scroll/issues/3291544#comm...
by setting pager id to 1

himanshu_jhaloya made their first commit to this issue’s fork.

himanshu_jhaloya’s picture

I have tested this branch 2.0.0 it is working fine in Drupal 10