a8cteam51 / query-loop-load-more

Adds a "load more" option to the query loop pagination block in Gutenberg.
GNU General Public License v3.0
7 stars 1 forks source link

Load More Button loads initial posts from Query Loop instead of more (unique) posts #5

Open jessLundie opened 9 months ago

jessLundie commented 9 months ago

Issue Description Clicking the Load More button results in the same set of blog posts being loaded a second time, rather than new / additional posts loading below the initial query loop.

This issue can currently be seen on the blog on https://crussen-production.mystagingwebsite.com/

Steps to reproduce

  1. Go to the blog "Mind"
  2. Scroll down to the "Load more" button
  3. Click the button

What you expected to happen

I expect the "Load more" button to load another set of 6 blog posts (or if less are available like in our case). It should load the remaining blog posts.

What actually happened

When I click the "Load more" button, it loads the same 6 initial blog posts again.

jessLundie commented 9 months ago

A bit more information - not sure if we're going to want to address this in plugin functionality, or just add this to the readme.

I was able to resolve this issue by adjusting the settings on the Query Loop. With "Inherit Query from Template" enabled, we see the issue:

image

If I disable "Inherit Query from Template" and manually set the query parameters, the plugin functions as expected.

kylerunner commented 3 months ago

We're running into similar issues for Regenerosity. See below for Beth's description

Query Loop Load More Block issue I’ve left this up on staging so that you all can “see” the issue. I had noticed a formatting issue with the posts that auto-loaded before yesterday, but initial tests of the functionality had worked when this was installed. I did not try to fix the formatting issues IN the infinite scrolling content itself since this is obviously something that needs troubleshooting/fixing. When I dug deeper yesterday I discovered a few things that were not working as expected:

multiples of the same posts load on scroll – most of the time they are two in a row, but occasionally there will be three of the same post OR a different post will be in between the duplicate posts when I swapped to just the “load more” button instead of auto-loading, only one post loaded at a time and then the new “load” button took a LONG time to appear after each one the block pulls the query post template from the featured query on the page and not the actual query for the majority of the post https://github.com/a8cteam51/query-loop-load-more/issues/5 appears to be related, but I think the issue on this page is deeper than the one described in this ticket.

I made a test page to try out experiments on the site with a page that is completely fake. There are visual issues with this page because I did not attempt to template it properly, but there is a version of the blog query that IS working with the load more on scroll functionality on this page. In addition to the settings requirements mentioned in the Github issue above, the block is super confused in this context. Based on my testing this is because of two things present on our “real” blog page that I took out of the test one:

The block appears to not respect the offset value of the query loop it’s supposed to be attached to. The block is super confused since there are two queries on the page (one with just the featured post and one with the rest of the landing page post content).

@geoffguillain or @tiagonoronha do you think this is something we should try to solve before we do our final submission for this plugin to be open sourced?

kylerunner commented 1 month ago

@mlaetitia or @geoffguillain pinging again on this one too. Same as the other issue, I can make this a dev request if so. Thanks!

nickpagz commented 1 month ago

I've added a potential fix for this issue in #14 It would be great to get someone to test and review the change to make sure it's done right.

I also noticed a second issue that occurs when there's multiple query loop blocks on the page, even if only one of them is using the load more button. The load more button will load posts from whatever the first query block is on the page. For example, if the first query block is for pages, and the second are posts, using the more button to load more posts will add pages. I believe it's either related to Glynn's #12 issue where the params are not properly loaded, or the block/plugin is not fetching from the correct query id. I have not looked into this issue yet, but will try to see what I can do later this week.

gin0115 commented 1 month ago

I tested multiple query loops

initial url = https://pinkcrab.gq/some-test/ added 2 query loops

poiton id post type
1st 3 product
2nd 14 post

none have infinite scroll and the templates are title then the post type


Inital page load URL = https://pinkcrab.gq/some-test/?glynn=tired image


Clicked load more on product URL = https://pinkcrab.gq/some-test/?query-3-page=2 image


Clicked load more on post URL = https://pinkcrab.gq/some-test/?query-14-page=2 image (this loads page 1 of loop 3)


However if i access https://pinkcrab.gq/some-test/?query-14-page=2&query-3-page=2 I get page 2 of both loops loaded image I cant even get Post 2 and Some Post to load if i have both loops on the page.

nickpagz commented 1 month ago

I've merged a fix for this and it's now live.