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 block in front end renders only the first element #25117

Closed
ntsekouras opened this issue Sep 7, 2020 · 0 comments · Fixed by #25028
Closed

Query block in front end renders only the first element #25117

ntsekouras opened this issue Sep 7, 2020 · 0 comments · Fixed by #25028
Assignees
Labels
[Block] Query Loop Affects the Query Loop Block [Type] Bug An existing feature does not function as intended

Comments

@ntsekouras
Copy link
Contributor

Describe the bug
Something recently broke the rendering of Query block in front-end. While the query block works as expected in FSE, when trying to view the page in front-end, only the first element is displayed.

In some searching I've done, I noticed in query-loop/edit.js:

  1. That $posts = get_posts( $query ) are correct
  2. The $content is not because it's missing the post-contents but do have all post-titiles. It still renders only the first one though.

Also by changing the query-loop/save.js to return a div wrapper to apply the block's attributes ( which in this case is class=wp-block-query-loop), the rendered output in front-end is both post-title and post-content but only for the first item..

I have searched many recent PRs but I haven't found the cause of this and WP_Block class hasn't changed for a couple of months (https://github.com/WordPress/gutenberg/blob/master/lib/class-wp-block.php).

To reproduce
Steps to reproduce the behavior:

  1. Enable FSE and add a Query block
  2. Observe that in editor everything works as expected
  3. View the page in front-end
  4. Observe the missing rendered things/parts

Expected behavior
Rendered parts/posts should be the same as in the editor

@ntsekouras ntsekouras added [Type] Bug An existing feature does not function as intended [Feature] Full Site Editing [Block] Query Loop Affects the Query Loop Block labels Sep 7, 2020
@ntsekouras ntsekouras changed the title Query block in front end renders only the first title Query block in front end renders only the first element Sep 7, 2020
@sirreal sirreal self-assigned this Sep 7, 2020
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

Successfully merging a pull request may close this issue.

2 participants