Skip Navigation

[Resolved] Pages with intricate views and JS fail to load

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 8 replies, has 1 voice.

Last updated by MattI4840 1 month, 1 week ago.

Assisted by: Minesh.

Author
Posts
#2800797
Screenshot 2025-03-14 145140.png
Screenshot 2025-03-14 143115.png

I am trying to:

I'm using Divi theme with ToolSet and up until recently, while slow, the pages that use intricate views (views that have other views embedded) worked without issue. Recently, they have begun failing to load, and even the Divi menu does not load correctly. I'm uploading a screenshot of a working page with a simple view, and then one where the page refuses to load.

Important to note that now I cannot even edit these pages as the divi builder refuses to load when attempting to as well and I get a blank page.

Also, I attempted to share the duplicator files with you, but the site doesn't recognize OneDrive as an acceptable file sharing platform for some reason. I can provide the link in a private reply.

Thanks!

#2801074

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

When I checked I see there is a fatal error related to memory.

PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 2097152 bytes) in /htdocs/wordpress/wp-includes/class-wpdb.php on line 2316

Can you please try to increase the WP_MEMORY and WP_MAX_MEMORY limit.

More info:
- hidden link

#2801170

Minesh,

I've increased the WP_MEMORY and WP_MAX_MEMORY limits to 1024 and 512 respectively which is well above the 268MB you outlined in the error message, but I'm still seeing the same result. It's likely important to mention that when I switch to one of the built in WP themes I am able to load the reports (obviously all the stying ect from divi is gone) but it does load the views then.

Thanks,
Matt

#2801321

Minesh,

Please let me know if there is anything else that can be done. If I have to move to another theme it's going to be dozens of hours worth of work recreating everything that Divi is doing. There has to be some other type of work around here.

Thanks,
Matt

#2801370

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok so culprit is not the Divi theme but how you are displaying your content with the nested view.

With the page: hidden link

You are displayign the following view:
- hidden link

<div class="inner-tbl">[wpv-view name="per-warehouse-inventory-view-p4"]</div>

When I checked the above view has nested view:
- hidden link

The issue with with the above view "per-warehouse-inventory-view-p4" you set the view to query multiple post types that is "Containers" and "Shipment" and when I checked both the post types both post types having thousands of entries:
=> hidden link
=> hidden link

So it will try to query both "Containers" and "Shipment" posts that collectively becomes huge amount. I suggest you should find a way to either add a pagination or display it differently per post type that will help you to resolve your issue.

#2801401

Hey Minesh,

That is only partially accurate, while we are querying both containers and shipments, I'm also using a conditional to narrow the scope of the responses down to a few hundred (the conditional removes any posts that are "archived"). I'm also reducing the overall amount of records daily by auto-deleting posts that are a year old and archived, so the strain on the conditional should become less over time as well.

embedded view = per-warehouse-inventory-view-p4

conditional code:

<tbody class="wpv-loop js-wpv-loop">
<wpv-loop>
[wpv-conditional if="( $(wpcf-container-archived) ne '1' ) AND ( '[wpv-post-type show='single']' eq 'Container' )"]
<tr>
[wpv-post-body view_template="loop-item-in-per-warehouse-inventory-view-p4"]
</tr>
[/wpv-conditional]
[wpv-conditional if="( $(wpcf-shipment-archived) ne '1' ) AND ( '[wpv-post-type show='single']' eq 'Shipments' )"]
<tr>
[wpv-post-body view_template="loop-item-in-per-warehouse-inventory-view-p4"]
</tr>
[/wpv-conditional]
</wpv-loop>
</tbody>

If there is a better way to apply the filters to only include non-archived containers and shipments, perhaps through custom code let me know. I've tried and just getting the custom code filter that is applied to the view that uses AND instead of OR took forever to get working.

I really hope Divi isn't the issue, but it doesn't make sense that it was working up until about a week ago. While slow, it did actually load the page and provide results.

Thanks,
Matt

#2801534

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

It's not partial but the fact that if you remove that view "per-warehouse-inventory-view-p4" or try to add pagination to that view, you will see that page is functional and dworking. Adding conditionals does not mean that view is not going to query the post.

When you add conditional shortcode view actually query the post and based on condition it will show/hide that post but the post is available with the view result set.

You can try to add "Query Filter" instead of [wpv-conditoinal] shortcode for your custom field and remove the conditonal but again as you are quering two post types "Containers" and "Shipment" you need to check if query filter for your custom field "container-archived" works or not.

And to offer you solution I need bit post-relationship background and what exactly you are displaying with what view and what is your expected result then I can try to thing of any other soltuion if exists.

#2802058
Screenshot 2025-03-24 115215.png

He Minesh,

Happy to provide some further background on this. The screenshot attached is what the view ultimately creates, the redacted text are the names of the warehouses, note this image is from my dev server, if you'd like access to that where you can access the view without touching the production site, just set the next message to private and I'll provide the info.

So basically what I did was create a view called "Per Warehouse Inventory P3" that queries the warehouse posts (currently 11 total, but only 8 published), then the nested view "Per Warehouse Inventory P4" queries the shipment and container posts that are associated with each of the warehouses. This segragates the containers and shipments per warehouse, and those results are hidden on the page.

I'm then using JS to walk through the results for each warehouse's containers and shipments to provide several different totals for the end user as you can see in the screenshot, as there are different product types, packaging types, and tonnage and values, then all of that is totaled up for a final total for each wareshouse.

I'm continuing testing today, and my initial thought was to add a drop down select to the "Per Warehouse Inventory P3" view that returns the warehouses, if I can limit the end user to only selecting a single warehouse at a time it should solve the issue by cutting the results back drastically, but I don't see an option to do that when going through the filtering options on the view.

If you have any suggestions on that front or any other please let me know. I'm not sure why this all of a sudden became an issue, this report has been working for several years now, and while it wasn't exactly fast to load, it didn't just stop and show a half loaded page. Oddly, it seems to load fine right now on the dev sever that has less than half the resources of the production sever (if that).

Thanks,
Matt

#2802073

Minesh,

I added a new field to the warehouse cpt "Warehouse Name" so that I can then filter on that. While it works in the dev environment, the view still loads all warehouses when the page first loads. Is there any way to keep it from loading the view results until after the submit button is clicked?

If not I'll have to look into other ways of limiting the results.

Thanks,
Matt

#2802229

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please send me details where on what view you added the "Warehouse Name" filter?

I maybe have different idea as well but if you can share dev site access details I will try to check and share with you details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2802279
#2802327

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now.

To your view I've added the filter as given under:
=> hidden link

<div class="form-group">
	<label for="wpv-wpcf-warehouse-name">[wpml-string context="wpv-views"]Warehouse Name[/wpml-string]</label>
	[wpv-control-postmeta type="select" field="wpcf-warehouse-name" default_label="Please Select" placeholder="Please Select" url_param="wpv-wpcf-warehouse-name"]
</div>

I've added the following code to "Custom code" to code snippet "query-with-or":

add_filter('wpv_filter_query', 'func_force_selection_of_option',99,3 );
function func_force_selection_of_option( $query_args, $view_settings, $view_id ) {
    if ( $view_id == 1382) {
      		if(!isset($_GET['wpv-wpcf-warehouse-name'])) {
      			$query_args['post__in'] = array(0);
            }  
       }
    return $query_args;
}

Can you plase confirm it works as expected now.

#2802340

Minesh,

This appears to be working and it's loading results as expected. Thank you for all your help on this!

Matt