SOLVED: Template/Shortcode Element renders template despite status draft or trashed

Bricks Version: 1.7.0-Beta

Hi,

Since popups don’t support loading content with AJAX yet, I knew it will add a lot of bloat to DOM elements, since these are dynamic popups based on the dynamic data coming from the loop. I have 5 elements in the loop sort eventually there are 5 popups. In order to compare how many DOM Elements are added, I wanted to disable popups

The issue is that despite:

  • removing interaction that triggers a popup on button click
  • changing this popup’s template status from published to draft

When you inspect a structure in the console, you can see the popups are there (but hidden).

I have disabled LS Cache, disabled caching query loops in Bricks settings, restarted Litespeed server, disabled Redis (which without caching queries in Bricks settings and LS Cache enabled should cache any data), but nothing helps - the data coming from all 5 popups is still there.

Any ideas?

[EDIT]

So there is a bug, but a different one.

In order to have a popup working with a dynamic data, it’s required to place a Template Element next to a trigger element (so for example a button) or as a child element (so a div or wrapper can be a trigger).

Even if I disabled a popup trigger and changed a status of this popup template to draft or even if I removed it to trash, a template element would still recognize the content. So in the select field to pick a template under Template Element, while it didnt recgonize a template name, this popup template was still there…

So a bug is that you have to completely disable all triggers for (at least) popup template, otherwise even it’s a draft or put in trash, its content still will be triggered.

So since I have a lot of dynamic data inside a popup and few sections, each consists of of around 70 DOM elements. So when I removed popups, total DOM elements went down from 530 to 170. None of the popups DOMs would have been loaded if there was a feature “load popup content with ajax”

Hope it’s gonna be implemented very soon.

Hi Dominik,
Thanks so much for your extensive report!

However, it would be much easier to understand if you could give me simple, numbered steps that I can use to recreate and understand your problem. I know you care a lot about pop-ups, so please do me a favor and make it as easy/quick as possible for me. The faster we are able to reproduce issues, the faster we can solve them :v:

Best regards,
timmse

Hi!

Here we have such information:

" If no interactions are defined on the popup itself or any other element on the page that triggers the popup to show, the popup remains hidden ."

Then we have this section:
" Example: Popup inside query loop

You can also add a popup inside a query loop via the Template element. Inside the popup template, you can use dynamic data to display data of the loop item."

So this is what I did:

  1. Created a query loop for Terms
  2. Created a Popup Template, with dynamic data pulling information from some dynamic fields
  3. Created a button with interaction to trigger a popup (I picked a popup template from the list)
  4. Inserted Template Element just bellow the button and picked a a popup template.

Especially with 1.7 beta, some bugs were fixed and popups work better. However, since there is no load popup content with AJAX, I wanted to check with GTMetrix, what’s the impact of popup content on the load times and DOM elements. In this case, I’ve only had 5 looped items and 5 popups, though popups had A LOT of content, with many dynamic data elements, query loops and dynamic accordions.

So I thought (initially forgetting about a Template Element) let’s just change a status of a popup from Published to Draft - the way WordPress works is that no data should be rendered on the front-end (Post, Page, Template), unless it’s status is set as published.

Then when checking the results, when inspecting page, I was surprised to see whole content of all popups in the structure.

Next, I disabled a trigger - no help. I moved a popup template (with already draft status) to Trash - content still loaded.

I then realized, a Template Element is still there. So under template list, while there was no longer the popups template name, instead (because it was in trash) there was a popup ID. This was a reason why directly caused a popup content showing in the structure.

So in order to get rid of the content from the page, I manually had to remove ID from the list or remove template element.

Is there any reason why would it still load the content? How is it possible that a content is loaded despite a template being in trash? I’m not sure if that’s a case only for:

  • popup template’s only or all template types
  • if for some reason native WP posts or custom posts are still triggered

But at least with popup templates it seems it always loads the content, while there should be a condition “display content only if template status = published”

Hope it’s clear now! :slightly_smiling_face:

Thanks,
Dominik

Hey Dominik,
Thank you for all the information.

In summary: The template element still renders the template, even though it is set to draft or sent to trash (independent from popups) - got it :+1:

I’ve added it to the bug tracker.

Best regards,
timmse

Hi Dominik,
We’ve fixed this bug in Bricks 1.7.1, now available as a one-click update in your WordPress Dashboard.

Please let us know if you are still experiencing issues.

Best regards,
timmse