CRM-16889 - Don't force-refresh the changelog tab to avoid performance overhead
authorColeman Watts <coleman@civicrm.org>
Tue, 21 Jul 2015 20:07:13 +0000 (16:07 -0400)
committerColeman Watts <coleman@civicrm.org>
Wed, 22 Jul 2015 17:07:12 +0000 (13:07 -0400)
templates/CRM/Contact/Page/View/Log.tpl
templates/CRM/Contact/Page/View/Summary.js

index 416b2663a6e60bb4ff86cf84b06f4f4bb8dc65e7..f9bbd4277cb54eca67249c264e6ff524945b1156 100644 (file)
@@ -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});
   });
 
index 960ec099c1f68c2b351818661c62465c388cffc2..0462365eaaac9ea9ac266f20d50fe27f48219884 100644 (file)
         }
       })
       .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(','));