Ajax function causing performance issues

Posted in: Newspaper
Post count: 1

Hello.

There is a function of the Newspaper 9 theme (I must keep this version for now) causing severe performance problems in my website.

I would like to know what this function does and what could happen if I simply disable it.

Thank you in advance.

– – – – – – – – – – – –

File:
Newspaper/js/tagdiv_theme.js

Function:

/**
* makes a ajax block request
* @param current_block_obj
* @param td_user_action - load more or infinite loader (used by the animation)
* @returns {string}
*/
tdAjaxDoBlockRequest: function(current_block_obj, td_user_action) {
//search the cache
var currentBlockObjSignature = JSON.stringify(current_block_obj);
if ( tdLocalCache.exist(currentBlockObjSignature) ) {
//do the animation with cache hit = true
tdBlocks.tdBlockAjaxLoadingStart(current_block_obj, true, td_user_action);
tdBlocks.tdAjaxBlockProcessResponse(tdLocalCache.get(currentBlockObjSignature), td_user_action);
return 'cache_hit'; //cache HIT
}

//cache miss - we make a full request! - cache hit - false
tdBlocks.tdBlockAjaxLoadingStart(current_block_obj, false, td_user_action);
//return;
var requestData = {
action: 'td_ajax_block',
td_atts: current_block_obj.atts,
td_block_id:current_block_obj.id,
td_column_number:current_block_obj.td_column_number,
td_current_page:current_block_obj.td_current_page,
block_type:current_block_obj.block_type,
td_filter_value:current_block_obj.td_filter_value,
td_user_action:current_block_obj.td_user_action
};

console.log('tdAjaxDoBlockRequest:');
console.log(requestData);

jQuery.ajax({
type: 'POST',
url: td_ajax_url,
cache:true,
data: requestData,
success: function(data, textStatus, XMLHttpRequest) {

tdLocalCache.set(currentBlockObjSignature, data);
tdBlocks.tdAjaxBlockProcessResponse(data, td_user_action);
},
error: function(MLHttpRequest, textStatus, errorThrown) {
console.log(errorThrown);
}
});
},

Post count: 18283

Hello !

Please note that we do not recommend removing anything that is in the theme. You can however to create a dev or a test site and comment that section in order to see what happens.

Let us know the result !

Thank you !

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.