Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Loop Pagination: When there are multiple queries with pagination - paging seems to affect both loops #53006

Closed
jordesign opened this issue Jul 27, 2023 · 3 comments
Labels
[Block] Query Loop Affects the Query Loop Block [Type] Bug An existing feature does not function as intended

Comments

@jordesign
Copy link
Contributor

Description

On a page with 2 (or more ) Query Loop blocks that allow paging - clicking to the next page of results loads the next set of posts for BOTH loops/queries.

When navigating to the next 'page' of either loop I found the URL was the same - appending ?query-13-page=2. My understanding is that the query-13 part of that is designed to target the specific query, but as both loops use the same ID it doesn't seem to work.

Step-by-step reproduction instructions

  1. Set up a page with 2 separate query loops. They'll need to not use the inherited query, and be separate queries (filtered for separate taxonomies).
  2. Make sure both of the Query Loops includes pagination.
  3. Publish and view the page - and then click to the next page of results for one of the Query Loops.

Screenshots, screen recording, code snippet

Screenshot 2023-07-27 at 11 49 23 am

On Initial Load

Screenshot 2023-07-27 at 11 49 14 am

Result when navigating to the next 'page' of either query

Environment info

  • WP 6.2.2 and 6.3RC2
  • No plugins
  • TT3

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@jordesign jordesign added [Type] Bug An existing feature does not function as intended [Block] Query Loop Affects the Query Loop Block labels Jul 27, 2023
@ntsekouras
Copy link
Contributor

👋 Thanks for the issue! Query Loop blocks need to have a different queryId in order for the pagination to work well. Currently this block(with queryId) and some other blocks too, are affected by an issue we have when we duplicate/clone blocks that need some attributes to have a special handling(for example being unique). See here for a currently stale attempt to do that.

Is that the case how you ended up with two Query Loop blocks with the same queryId? If yes, for now you should just update manually one queryId in code editor..

@jordesign
Copy link
Contributor Author

Thanks @ntsekouras - that is indeed how I generated the second query loop. That's good to know - thank you :)

@ntsekouras
Copy link
Contributor

@jordesign I'll close this issue then, as the root cause of your problem was caused by a different thing, being tracked elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Query Loop Affects the Query Loop Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants