Jetpack: Infinite Scroll Skipping Posts When Loading More Posts with a Button

Created on 6 Apr 2018  Â·  27Comments  Â·  Source: Automattic/jetpack

Steps to reproduce the issue

  1. Enable Infinite Scroll, selecting the Load more posts in page with a button
  2. Scroll to the bottom of the page
  3. Click the Older Posts button

What I expected

The next set of posts to be displayed

What happened instead

Infinite Scroll skipped the next X posts (where X is the number of posts to be displayed per page in the Reading Settings) the first time I clicked the button. Subsequent clicks of the Older Posts button load posts as expected.

Infinite Scroll [Pri] Normal [Type] Bug [Type] Happiness Request

All 27 comments

I'm seeing the same thing with Load more posts as the reader scrolls down.

@mikejolley or @tiagonoronha can one of you folks please take a look?

@zinigor Unable to replicate an issue loading page 2 of the blog page using Jetpack 6.0; chatting on Slack right now. Have a feeling there is an issue on Atomic sites.

Also reported in p9F6qB-ff-p2

Introduced in #9112 and #9120

query_time_filter causes this. I've asked in Slack if anyone knows it's purpose. If no one replies I'll raise a PR to remove it. I cannot see any logical reason to keep it.

I can confirm that commenting out query_time_filter seems to fix things for me and I haven't noticed any side effects. Thanks!

I've asked in Slack if anyone knows it's purpose. If no one replies I'll raise a PR to remove it. I cannot see any logical reason to keep it.

Conversation: p1523289557000157-slack-jetpack

query_time_filter was introduced in r79768-wpcom to fix 5774-wpcom and 4713-wpcom.

Commit

Infinite Scroll: reintroduce a query filter based on the last post’s date

This solves pagination issues where either a new post has been published
between IS fetches, or there are sticky posts affecting the posts flow.

Original issues

If you are on a page when a new post went up, when you scroll down, and it loads the next page and appends it to the current page, the top post on page 2 used to be the last post on page 1

Steps to Reproduce

  1. Create a blog with enough posts to at least fill the first page of posts.
  2. Publish a sticky post.
  3. Check the first page of posts — the last post on that page will disappear. (It doesn’t appear on the second page of posts.)
  4. Trash the sticky post — the missing post reappears.

Have a feeling there is an issue on Atomic sites.

I can reliably replicate this issue on a self-hosted site on Hostgator, using the TwentySeventeen theme. Front page is set to display 5 posts at a time. Pressing "Older Posts" skips the 6th-10th posts and shows the 11th-15th ones instead.

See the proposed patch above (#9256)

This issue is also happening here: 2741975-hc
An example of missing post is: https://resurgentart.com/2017/11/30/chi-rho-november-newsletter-jesus-close-to-the-brokenhearted/ in a category page:
https://resurgentart.com/category/chirho-newsletters/ (the category is correctly added)

Reported as well in 1110003-hc. Missing posts changed based on whether theme was showing featured content or not.

Changing Infinite Scroll to Load more posts using the default theme behavior solved problem

Reporting an issue today as well in 2822103-hc.
Site: https://katescrivfit.com/
Theme: Arcane
User was not seeing a published post on their front-end while on the setting "Load more posts while the reader scrolls down". Resolved the issue by setting the Infinite Scroll Setting to "Load more posts using the default theme behavior".

I have same problem, not sure when it started, but detected this week. It happens browsing full blog, also filtering per category or tag, and even while searching. I am using Penscratch 2 theme.

Also reported here: 1096151-zen

Another potential issue reported here: https://wordpress.org/support/topic/infinite-scroll-broken-2/
Investigating whether the user is having the very same problem or something else that involves the Infinite Scroll.

reported here 2884142-hc, suggested the workaround of changing the infinite scroll behavior to the theme's one but user was not happy, they wanted to use Infinite scroll as it is

Another report: 2892312-hc

1083318-zen is another example of a user who does not like the suggested workaround and would greatly prefer to be able to use infinite scroll. They are interested in seeing this fixed soon.

Also in 1087982-zen

Not sure I'm having the exact same issues as reports above, but definitely missing products in a WooCommerce shop with infinite scroll. Downgraded Jetpack to 5.9 which solved the problem.

I can see this happening on a site I support as well. It's set to load 20 posts at a time but when you click to load more it skips the next twenty.

@boboz @rickcurran and everyone else: could you try the patch suggested in #9256, and let us know if it works for you?

Thank you.

@jeherve Thanks! Yep, I've applied the updates to infinity.js and infinity.php in that patch and it seems to fix it for me. I've reverted them on my site just now and I'll wait for the plugin update to come out.

(I'm not sure if this is relevant / helpful info or not, I know some people were encountering this issue and it seemed to be related to their use of "offset" in the main query but for me it was "post__not_in" that I was using to exclude some post IDs held in an array stored in a transient.)

@jeherve @mikejolley I just installed and tested for a while and apparently it is working well. I will leave it installed for some time to test it more in deep. Thanks a lot for the patch!

In 2011528-zen, user experienced repeated posts when scrolling down to Older posts on their shop page

Was this page helpful?
0 / 5 - 0 ratings