NO BUG: The ajax load button is visible even if the list is empty

Browser: Chrome 110
OS: Windows

I created a CPT with ACF where I store the list of user reviews.
In the frontend the load button does its job and everything works correctly, but when the list is empty I think it should disappear, but instead it remains visible.

p.s.This behavior doesn’t happen the first time but only after I populate the CPT and then clear them.

Hi @ninmorfeo,

Thank you for your report. I think I may need more context to fully understand your setup. Could you please share temporary admin access to help@bricksbuilder.io with a link to this thread? Thanks :slight_smile:

i had sent you credential.

Hi @ninmorfeo,

Thank you very much for sharing access. Yeah you’re right there seems to be some inconsistent behavior with when the button is rendered. I have created an internal ticket to address this.

1 Like

Hi Paolo,

We’ve fixed this issue in Bricks 1.9.4, now available as a one-click update in your WordPress Dashboard.
Changelog: Bricks 1.9.4 Changelog – Bricks

Please let us know if you are still experiencing issues.

Best regards,
timmse

Hello!

I don’t know if it’s related with the bug above, but i had a “Load more” button with interactions for the button to disappear and appear when the AJAX Query started and ended respectively. It used to work fine. With one of the latest updates, once all the products are loaded the “Load more” button is still there (it used to dissapear, as expected). I was able to reproduce this in 2 different websites. Could you take a look into this issue, please? Thank you.

Note: Having only the first interaction on the button works fine, meaning that upon the last query load the button disappears. But the effect of the button hiding and showing is not there of course.

EDIT: Also, in a product category with only a few products the button is appearing (it used to be hidden).

Hey @Stathis, yep, seems like the fix has changed the behavior. We’ll take another look :v:

1 Like

Hi @Stathis ,

In 1.9.4, we changed the way to hide the Load More button via css class brx-load-more-hidden (Previously was display:none, using CSS class is more flexible for different user customization and easier code maintenance)
Hence, your Interaction that “Show element” (display:block) will overwrite our brx-load-more-hidden style. And that’s why the load more button still showing even if the query reaches max page.

To address this issue, you should remove the Query AJAX loader (End) interaction as Bricks will programatically hide or show the button.
And change the Query AJAX loader (Start) action to “Set Attribute”, Key = “class”, Value = “brx-load-more-hidden” (This way the button will be hidden when AJAX is calling)

Let me know if it works.

Regards,
Jenn

@itchycode
Hi! Sorry for the late reply. Your solution works for the most part, with one issue. I mentioned it in the last sentence of my previous post.

Lets say we have set 15 posts per page in the query settings of our archive template but in a specific category there are 15 or fewer results. The button is still visible in that case.

Cheers!

Hi @Stathis

We are aware of that problem, it will be improved soon when native Filter feature delivered.
As a workaround, you can also use Condition on the Load more button.

{query_results_count:XXXXX}
>
YOUR_POST_PER_PAGE_VALUE

Then the load more button will only be showing if the results is more than 15 post.

Regards,
Jenn

1 Like

How i did not think of that. :laughing: I have used the {query_results_count} before.

Thank you.

I used this on the button to load more. I’m sure that an interaction would be a more elegant solution:

%root%.brx-load-more-hidden {
display:none;
}