From e6a74b600ebb0a34b31f56e39fd4557746b35718 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 21 Jul 2015 16:07:13 -0400 Subject: [PATCH] CRM-16889 - Don't force-refresh the changelog tab to avoid performance overhead --- templates/CRM/Contact/Page/View/Log.tpl | 3 +++ templates/CRM/Contact/Page/View/Summary.js | 13 +++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/CRM/Contact/Page/View/Log.tpl b/templates/CRM/Contact/Page/View/Log.tpl index 416b2663a6..f9bbd4277c 100644 --- a/templates/CRM/Contact/Page/View/Log.tpl +++ b/templates/CRM/Contact/Page/View/Log.tpl @@ -65,6 +65,9 @@ } $('#changeLog .instance_data').crmSnippet('refresh'); }; + CRM.incrementChangeLogTab = function() { + CRM.tabHeader.updateCount('#tab_log', 1 + CRM.tabHeader.getCount('#tab_log')); + }; CRM.reloadChangeLogTab({/literal}"{$instanceUrl}"{literal}); }); diff --git a/templates/CRM/Contact/Page/View/Summary.js b/templates/CRM/Contact/Page/View/Summary.js index 960ec099c1..0462365eaa 100644 --- a/templates/CRM/Contact/Page/View/Summary.js +++ b/templates/CRM/Contact/Page/View/Summary.js @@ -332,15 +332,12 @@ } }) .on('crmFormSuccess', function(e, data) { - // Refresh changeLog - advanced logging - if (CRM.reloadChangeLogTab) { - CRM.reloadChangeLogTab(); - } - // Refresh changeLog - simple logging - // If we didn't get a changelog count in the response, force refresh the changelog tab to populate it - else { - CRM.tabHeader.resetTab('#tab_log', !(data && data.changeLog && data.changeLog.count)); + // Advanced logging... just increment the changelog tab count to avoid the overhead of reloading the data + if (CRM.incrementChangeLogTab) { + CRM.incrementChangeLogTab(); } + // Refresh changelog tab next time it is opened + CRM.tabHeader.resetTab('#tab_log'); // Refresh dependent blocks if (data && data.reloadBlocks) { reloadBlock(data.reloadBlocks.join(',')); -- 2.25.1