Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It's not loading second page if content is default view mode in the views.
Steps to reproduce
- Create a view page
- In FORMAT section select Content
- In PAGER section select Infinite Scroll
- Checked Automatically Load Content
- Use AJAX: Yes
- Save view and now go to view page and scroll down.
Comment | File | Size | Author |
---|---|---|---|
list-Content-D8_2.png | 73.71 KB | Devendra Mishra | |
list-Content-D8.png | 37.58 KB | Devendra Mishra |
Comments
Comment #2
Neslee Canil Pinto@Devendra Mishra not able to reproduce this issue, its working fine here
Comment #3
Devendra Mishra CreditAttribution: Devendra Mishra commentedHi @Neslee Canil Pinto, thanks for checking. I am using Drupal - 8.9.13 & Views Infinite Scroll - 8.x-1.8 & I am getting this issue when selecting Teaser as content in the views.
Comment #4
patrick.thurmond@gmail.comI'm seeing this very same issue on my D8 site. I even updated to the latest from 1.x-dev.
Drupal core: 8.9.16
We are including this on a page using Bricks (which is similar to Paragraphs). Tried other core Views pagers for AJAX loading the content and they work fine. They just don't do it in the manner that this module does.
When you look at the AJAX response, it shows the content that should be loaded. However, it never appears on the page. There are no JS errors in the console either. This leads me to believe that this view mode breaks whatever step is taken in the JS to display the new results.
Now we are using the EVA module (https://www.drupal.org/project/eva) and a Views display that is using that on the page. But given that other pagers have no issues I would contend that the problem lies in the Views Infinite Scroll module.
Here is what the config export for the view shows:
Comment #5
patrick.thurmond@gmail.comUpdate on this, I am currently scoping out the "docroot/modules/contrib/views_infinite_scroll/js/infinite-scroll.js" file. Specifically in the "$.fn.infiniteScrollInsertView" function.
I see it receiving the correct View ID. It has a proper contentWrapperSelector. When it tries to append the rows to the view object, that works too. At this point I am wondering how it could not be the "Drupal.attachBehaviors(view.$view[0]);" line.
Continuing to dig...
Comment #6
patrick.thurmond@gmail.comWhile poking around a bit more, I decided to recheck on local that it is still failing. And it no longer is. The added items are showing up. I rechecked on dev and it is still having the issue.
Here is what is different locally:
I did a config-export to be sure nothing else was in there and nothing was. It didn't even update the view config.
I did notice that when I switched to automatic loading it would do that action on page load instead of on scroll past.
I am pushing the code to dev to see if this solves it somehow.
Comment #7
patrick.thurmond@gmail.comOne last thing. I noticed that, post update to 1.x-dev, the layout output changed from two-columns to a single column. Which is super-weird. Not sure the exact issue there.
But I also noticed this issue with EVA Views that is in the dev branch but not in 1.8.
https://www.drupal.org/project/views_infinite_scroll/issues/2896459
As I mentioned previously, we are using EVA. So clearly that was my primary issue. Leaving all this documented for others to both see my stupidity and learn from it.
Comment #8
Alex Bukach CreditAttribution: Alex Bukach commentedDevendra Mishra, https://www.drupal.org/project/views_infinite_scroll/issues/3252577 helped me in a similar case, will you check it?
Comment #9
gMaximus CreditAttribution: gMaximus commentedSame issue for me. Switching to fields instead of content and everything works.
Comment #10
er.garg.karanI am also experiencing the same issue. It is specific to the scenario when we chose to choose content rather than fields. In my case, I'm using the teaser view of the content. As is mentioned in
views_infinite_scroll_preprocess_views_view
We are not getting any of these classes or the attribute
data-drupal-views-infinite-scroll-content-wrapper
added to the parent div inviews-view.html.twig
file.Comment #11
casivaagustin CreditAttribution: casivaagustin at 42mate commented@Alex Bukach I can confirm that the issue #3252577 patch #8 have solved the issue in my end.
Comment #12
casivaagustin CreditAttribution: casivaagustin at 42mate commentedCurrently the version 2.0.x-dev@dev has the fix in place.
Comment #13
Alex Bukach CreditAttribution: Alex Bukach commentedComment #14
Alex Bukach CreditAttribution: Alex Bukach commentedComment #15
Neslee Canil PintoAlso the change in #3252577: Stops loading after X amount of items(Drupal ^9.2.0 ) has been included in https://www.drupal.org/project/views_infinite_scroll/releases/2.0.0