SOLVED: First Element in Query Loop not Displaying Correctly in Builder

Bricks Version: 1.4 RC2
Browser: Chrome 101.0.4951.67
OS: Windows 10
URL: (a link to a page that illustrates the issue would be really helpful)

When using the “Use Query Loop” feature on a container, the first element on the repeater does not display child elements or dynamic data correctly. This appears to only be an issue within the builder - as the front-end renders correctly. See screenshot examples below.

This first screenshot is from the builder. The Query Loop is set on the container and only the Title of the post (CPT) is displayed. Placeholder image (which is an ACF field) is displayed for the related image and no numerical number (also an ACF field) is displayed above the title. I tried adjusting the query order to see if this was related to this one post - and this happened for any post that was first in the loop.

The second screenshot is from the front-end - where the image and number are displayed as intended.

I also tested this same loop within the Posts element and these dynamic fields display correctly in the builder - so it appears to be isolated to the Query Loop function.

1 Like

Following up with second screenshot - since it would only allow me to upload one image per forum post.

I wanted to circle back and add more information to this - as I am struggling to understand the intended behavior (if it is a bug or something not accounted for yet).

I found in another forum post where information was provided on how to access the post loop variable within the Query Loop - so I used that to see if I could just get it to print the current post_id.

Added a code block within the Query Loop and the following code:

$post_id = \Bricks\Query::get_loop_object_id();
echo $post_id;

As you can see from the screenshot below, this does not get rendered in the first iteration of the loop either. It does on the front-end - however. But this does not help with designing the actual element within the builder bc the rendered elements are not displayed properly (or at all).

Hi Brandon,
Welcome to the forum and thanks for reaching out!

A loop usually consists of several items, so you can see the styling either way. The first item serves as a template in the builder and we think it makes sense that e.g. dynamic data tags are displayed as a tag to be able to recognize them quickly and unambiguously. This is especially handy when the loop item is relatively complex. The topic has also been discussed here before: Dynamic data not rendering in builder

I understand that it’s confusing for you that, for example, the Post Title is displayed in the first iteration, but your custom code from the Code element is not - but is that really a problem? As I said, in your example, you see more iterations that get the styling that you apply to the template (the first iteration). The only difference is that in Frontent the first element is the first post and not the template. Everything else is identical.

Best regards,

1 Like

I agree with @timmse, I personnally like to see the dynamic tags generating the frontend display, even if sometimes it messes up the backend display.

1 Like

@timmse Ok. Thank you for confirming this is the intended behavior. Not sure i agree completely with the approach of displaying the dynamic tags - especially since you can access the element in the structure and see the dynamic tag in the control. I have seen this to be awkward when it comes to using custom functions with parameters which can get quite lengthy and really mess with the display (like in tab titles). But i also understand your approach.

At any rate thank you for this awesome tool. You are doing fantastic work.

1 Like

@timmse please mark this one as solved.