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 Block: Selecting to include sticky posts ignores the set number of items per page #71294

Closed
sharonlaker19 opened this issue Dec 18, 2022 · 14 comments
Labels
Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". [Feature] Core Blocks Blocks that come with Gutenberg. [Feature Group] Editor Experience Features related to Gutenberg integration on WordPress.com. [Platform] Atomic [Platform] Simple [Pri] Normal Schedule for the next available opportuinity. [Product] WordPress.com All features accessible on and related to WordPress.com. [Status] Core Fix Needed A fix within the Core WordPress or Gutenberg project is required to resolve this issue. Triaged To be used when issues have been triaged. [Type] Bug

Comments

@sharonlaker19
Copy link

sharonlaker19 commented Dec 18, 2022

This issue is open primarily for tracking, as the relationship between the QL block and sticky posts is a discussion in the Core Gutenberg project. See this comment for details.

Quick summary

When you set the Query Loop block in the Site Editor to include sticky posts, it ignores the number of posts selected under Items Per Page. It seems to be combining the sticky posts plus the number of posts selected per page, instead of showing the set number of items per page.

Steps to reproduce

  1. Start with a site on an FSE theme and X amount of existing sticky posts.
  2. Set your template to use a Query Loop block.
  3. Select to include sticky posts in the Query Loop block.

sticky posts include

  1. Set the Items Per Page to Y.

items per page

  1. The Query Loop block in the Editor will show the selected Y amount of posts.
  2. When you publish your changes, however, the page will show X + Y posts instead of the selected Y posts (including sticky).

What you expected to happen

I expected the page to only show the chosen number of items per page.

What actually happened

The page shows the chosen number of items per page, plus the sticky posts.

Context

No response

Platform (Simple, Atomic, or both?)

Simple, Atomic

Theme-specific issue?

No response

Browser, operating system and other notes

No response

Reproducibility

Consistent

Severity

Some (< 50%)

Available workarounds?

Yes, difficult to implement

Workaround details

They can use the Blog Posts block and manually select the posts they want to display, or include the sticky posts in their own category/tag.

@sharonlaker19
Copy link
Author

  • 5776006-zen

@github-actions
Copy link

github-actions bot commented Dec 18, 2022

Support References

This comment is automatically generated. Please do not edit it.

  • 5776006-zen
  • 6752049-zen
  • 7184426-zen

@jp-imagines
Copy link

Came across this in 5450024-hc as well. Simple site on the Morden theme.
Possible related issue: #61620

@zachspears zachspears added the Triaged To be used when issues have been triaged. label Dec 28, 2022
@zachspears
Copy link

I was able to reproduce this. I also noticed that the Query Loop block would display the correct number, including the Sticky post, if the sticky post would have been included regardless. For example, if the sticky post is three posts ago and you display three posts, then the Query Loop Block will display the correct number. If you change the Block to display two posts, it will display three posts to include the sticky post, as outlined in this issue.

Keeping Low priority due to low impact.

@dpasque dpasque added [Pri] Low Address when resources are available. and removed [Pri] Normal Schedule for the next available opportuinity. labels Dec 30, 2022
@dpasque
Copy link
Contributor

dpasque commented Dec 30, 2022

Switching normal for low priority based on above comments.

@dcoleonline
Copy link
Contributor

I encountered this today while building a site for a Built By Express customer. They needed 15 posts to show, but when a post older than their most 15 was marked as sticky, the block showed 16 posts.

@github-actions github-actions bot added the Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". label Aug 16, 2023
@room34
Copy link

room34 commented Aug 16, 2023

dpasque

Switching normal for low priority based on above comments.

Can you explain which of the above comments you feel warrant lowering the priority of this issue?

@dpasque dpasque added the Cross Repo Tracker For issues that are tracking issues in other repositories label Aug 18, 2023
@dpasque
Copy link
Contributor

dpasque commented Aug 18, 2023

Hi @room34! 👋

Can you explain which of the above comments you feel warrant lowering the priority of this issue?

This was a bit ago and I don't fully remember my reasoning at the time, but I'm pretty sure I was just making the labels match the priority laid out in the initial triage comment.

I did take this chance though to revisit and retriage this issue! 👍

This issue is kind of complicated! Frustratingly, it looks like this is a weird quirk in the current design of sticky posts, and has a long history of its discussion. That said, it still makes the Query Loop block pretty useless if you are in the state where you want...

  1. To use sticky posts on your site, and...
  2. have them included in a query, but...
  3. not stuck to the top of each page, but rather just sorted to the front of the query.

Fortunately though, there's already an issue open in Gutenberg to discuss providing better handling at the Query Block level, and this issue is included in the tracking issue that lays out the next steps planned for the Query Loop block.

(For clear reference, here is the full Gutenberg URL: WordPress/gutenberg#41184)

So, I think the discussion about the design of the block should continue on that Gutenberg issue, especially because this is something of a design change that impacts the broader WordPress community. 👍

We can keep this issue open as a cross-repo tracker issue and document WordPress.com users that are impacted or interested in the change. In the meantime, we can also use this issue as a place to help lay out alternative solutions based on site configuration and what people would like to accomplish! There are a few other blocks (like the Blog Posts Block) that provide alternative ways to listing posts.

We can also bump the priority of this tracker issue back up to "Normal" to match the categorization of this issue in the Gutenberg tracking issue.

@dpasque dpasque added [Pri] Normal Schedule for the next available opportuinity. and removed [Pri] Low Address when resources are available. labels Aug 18, 2023
@room34
Copy link

room34 commented Aug 18, 2023

@dpasque Much appreciated. I agree this is a sticky (no pun intended) issue… the SQL going on behind the scenes when querying sticky posts is brain-melting. I've managed to find a workaround for the problem in my specific case, and I think at least part of the problem was a misunderstanding of what "sticky" really means. But, non-technical users are almost certainly going to also misunderstand what it means, and find themselves with an extra post getting returned in Query Loop blocks. I'm hopeful the situation can be resolved in a future update!

@dpasque
Copy link
Contributor

dpasque commented Aug 18, 2023

@room34 Totally agree there with you on all of that! 🙂 I had a similar brain-melting experience diving into the history and current meaning of "sticky" haha... 😆 It's an old concept that just doesn't play very nicely (or how the average person would expect) in the new era of block themes, etc. And as the future direction doubles-down on block-based full site building, it feels like we'll need to expand our options for classifying and sorting post content within index-like blocks. Fortunately, it looks like there's a lot of discussion in the area happening in the Gutenberg space!

Glad to hear you were able to find a workaround for your current situation. 👍

@masperber
Copy link

Another report here: 6752049-zen

@masperber
Copy link

Another report here: 7184426-zen

@cuemarie cuemarie added [Status] Core Fix Needed A fix within the Core WordPress or Gutenberg project is required to resolve this issue. [Product] WordPress.com All features accessible on and related to WordPress.com. [Feature Group] Editor Experience Features related to Gutenberg integration on WordPress.com. [Feature] Core Blocks Blocks that come with Gutenberg. and removed Cross Repo Tracker For issues that are tracking issues in other repositories labels Oct 28, 2023
@alaczek
Copy link
Contributor

alaczek commented Oct 15, 2024

This has been reported in core here: WordPress/gutenberg#64083

@davemart-in
Copy link
Contributor

This should be fixed in core. Closing this issue in preference to the issue in core that Ola linked to above.

@davemart-in davemart-in closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". [Feature] Core Blocks Blocks that come with Gutenberg. [Feature Group] Editor Experience Features related to Gutenberg integration on WordPress.com. [Platform] Atomic [Platform] Simple [Pri] Normal Schedule for the next available opportuinity. [Product] WordPress.com All features accessible on and related to WordPress.com. [Status] Core Fix Needed A fix within the Core WordPress or Gutenberg project is required to resolve this issue. Triaged To be used when issues have been triaged. [Type] Bug
Development

No branches or pull requests

10 participants