• Resolved Tony G

    (@starbuck)


    I try to be very professional when asking about potential issues or reporting verified issues. Sometimes, like in this case, I see occasional weirdness and need to ask if there is known weirdness in a specific area – or if maybe I should look deeper to see if this is something new. So … sorry for being a little vague here…

    I’m using GenerateBlocks in a new installation with the default TwentyTwentyThree theme. The “weirdness” I’m seeing is that QueryLoop seems to fail if it is located within a Synced Block Pattern (reusable block) that is nested within a Template Part. Or perhaps there is some combination of these : pattern within another pattern that is then within a part…

    The question is, are devs aware of any open issues that sound like they fit into this category? If not, of course I’ll do the research and report specifics if required.

    Here is an example of what I mean:

    And the query:

    What’s weird? Sometimes the query will be ignored and all posts will be selected. This isn’t random. I need to nail down the specific pattern of block nested that May cause this … and verify that it’s not being affected by another plugin.

    Right now this is just a high level inquiry, not a request for specific action. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support ying

    (@yingscarlett)

    Hi @starbuck ,

    The Grid block nested in the Query loop block is not supposed to be a reusable block.

    All the content inside the Query loop block is dynamically generated with different IDs. But reusable blocks have the same IDs, which means if you change anything to a query, the other queries might or might not change, it will cause an internal failure in the block itself.

    If you want to create a reusable block for a Query loop, yes, you can, but if you want to make changes to the inserted reusable block, make sure you convert it to a normal block and duplicate the query loop. This is important as duplicating process generate a new set of IDs, which makes the query loop a new one, and then you can make changes to it without interfering with other queries.

    Thread Starter Tony G

    (@starbuck)

    Thank you, Ying. I think that helps. To be clear, the reason the blocks are structured like this is to link a consistent query loop with consistent output.

    If I change the query, yes, I expect all attached/reusable instances of that block to use the new query.

    If I replace Private Post List Wide (within the grid) with Private Post List Columns, yes, I expect all attached/reusable instances of that block to now display columns.

    If I want to replace the query for one page, yes, the instance must be detached – though the output block would remain as the default, and that would still be a dynamic/reusable block unless it too is detached.

    However, are you saying that there is a single grid instance across the reusable blocks and that a query on one page will affect the results on another page because they share the grid instance ID? That would be a problem!

    I don’t understand how that could be. Is the code for these blocks cached among pages rather than being reprocessed on each page?

    If this is the problem I will gladly remove the grid and query loop from the reusable wp_blocks and wp_template_parts. But that significantly limits our ability to take advantage of the great new reusability features in WP.

    Thanks!!

    Hi @starbuck,

    The ID is for the Design/Layout, not for the Query. But I imagine using a WordPress reusable Block may cause such issues as well.

    What we would recommend is using a Pattern and a Global style instead for your GB Query Loops. This is available only with GB Pro though. Reference:
    https://docs.generateblocks.com/article/pattern-library-overview/
    https://docs.generateblocks.com/article/global-styles/

    Hi there! We haven’t heard back from you for a while now so we’re going to go ahead and set this topic as resolved. Feel free to open a new topic if you need assistance with anything else.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Query Loop in nested blocks?’ is closed to new replies.