Hi,
in my case, the button (automatic load or not) runs the load-more animation, but then nothing comes. No new markup is loaded anywhere in the page. I've tried it with all external exposed filters & masonry removed - no change. No JS errors, no errors in drupal log? What am i missing? Debugging tips?

Comments

dotist created an issue. See original summary.

dotist’s picture

actually, a js console warning is displayed: Synchronous XMLHttpRequest on the main thread is deprecated

alioso’s picture

Synchronous XMLHttpRequest on the main thread is deprecated is unrelated

Not sure what theme you are using, but this probably comes from the fact that you don't have the proper meta tag on your views-content container, which is what the JS is looking for to append the rows loaded through Ajax. You'd need to have:

<div class="view-content" data-drupal-views-infinite-scroll-content-wrapper>

for the plugin to trigger.

data-drupal-views-infinite-scroll-content-wrapper

probably being your missing piece. You can achieve this by templating (or editing) views.html.twig

dotist’s picture

great - i'll try that out!

Daniel Korte’s picture

I also have to manually add that container to my theme, but shouldn't the views_infinite_scroll_preprocess_views_view() function output this container for you? It seems this functionality is broken. I looked into it, but couldn't figure out why the container wasn't being rendered. I'm using a HTML List as my style plugin (if that helps).

gilmord’s picture

@Daniel Korte

It does not mean preprocess is broken.
It means your theme does not set "rows.attributes" in view template or unset those variable somewhere.

Daniel Korte’s picture

@gilmord I'm not sure what I'm missing here. I tried the below HTML in my views-view.html.twig file, but it doesn't work:
<div{{ rows.attributes }}>{{ rows }}</div>

I'm not saying that the preprocess function itself is broken. I'm saying the implementation of those attributes doesn't seem to be working.

RAWDESK’s picture

I've had a similar symptom after installing the 8.x-1.5 version, but it had nothing to do with some missing wrapper as mentioned in #3,
but with a by ajax returned exception on devel/kint.
My suggestion is to check in your browser console the ajax response after hitting "load more".
If it doesn't contain the expected views html structure to append, it responds empty without any error message popping up.

PS. Below a snapshot of my relevant div structure, created on page load by hook_preprocess_views_view() inside the module :

<div data-drupal-views-infinite-scroll-content-wrapper="" class="views-infinite-scroll-content-wrapper clearfix">  
  <div class="views-view-grid horizontal cols-2 clearfix">
    <div class="c-layout-page">
      <div class="c-content-box c-size-md">
        <div class="container">
          <div class="cbp-panel">

so no need to create the data div yourself

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.

Anybody’s picture

Status: Active » Postponed (maintainer needs more info)

@dotist: Is this fixed in 1.6?

Neslee Canil Pinto’s picture

I am not able to reproduce this issue. If it is fixed then we can close this issue.

huijse’s picture

I am using a Drupal 9 site and a solr view with infinite scroll and keep seeing the throbber / ajax progression wheel when the results are already loaded. I see no js error in the console.

Anybody’s picture

Is this still an issue with 2.0.x? If yes, please update the version and set the status active again with clear steps or (best) with a test showing what's broken.

2.0.x is the active development branch.

If nobody replies, we should assume this is fixed and close this issue outdated.

Thanks!