LP#1207744: fix display of duplicate results when viewing report folders
authorMike Risher <mrisher@catalyte.io>
Fri, 12 Jun 2020 22:17:44 +0000 (22:17 +0000)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 13 Aug 2020 13:58:07 +0000 (09:58 -0400)
When you repeatedly click the link to display a template, report, or
output folder on the reports UI, the contents of that folder can
display multiple times. This patch addresses this bug and prevents
duplicate contents from displaying.

Signed-off-by: Mike Risher <mrisher@catalyte.io>
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/web/reports/oils_rpt_folder_window.js

index 488cba6..b971995 100644 (file)
@@ -5,7 +5,7 @@ var NG_NEW_TEMPLATE_INTERFACE = '/eg/staff/reporter/template/new';
 var NG_CLONE_TEMPLATE_INTERFACE = '/eg/staff/reporter/template/clone';
 var OILS_TEMPLATE_INTERFACE = 'xul/template_builder.xul';
 var OILS_LEGACY_TEMPLATE_INTERFACE = 'oils_rpt_builder.xhtml';
-
+var currentlyLoading = false;
 
 /* generic folder window class */
 oilsRptSetSubClass('oilsRptFolderWindow', 'oilsRptObject');
@@ -24,6 +24,8 @@ oilsRptFolderWindow.folderIdMap = {};
 
 // Here lie the contents of a specific folder
 oilsRptFolderWindow.prototype.draw = function(viaPaging) {
+       if (currentlyLoading) return; // avoids loading same data repeatedly
+       currentlyLoading=true;
 
        _debug('drawing folder window for ' + this.folderNode.folder.name() );
 
@@ -535,7 +537,6 @@ oilsRptFolderWindow.prototype.createSearchRequest = function() {
 }
 
 oilsRptFolderWindow.prototype.fetchFolderData = function(callback) {
-
        hideMe(DOM.oils_rpt_content_count_row_2);
        hideMe(DOM.oils_rpt_content_row_2);
 
@@ -605,6 +606,7 @@ oilsRptFolderWindow.prototype.fetchFolderData = function(callback) {
                                        }
                                );
                        }
+                       currentlyLoading=false;
                }
        );
        req.send();