[open-ils-commits] [GIT] Evergreen ILS branch master updated. fafd2dca8f9c8d0e0d98428747174d8a0953ad2b

Evergreen Git git at git.evergreen-ils.org
Tue Oct 1 16:47:55 EDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  fafd2dca8f9c8d0e0d98428747174d8a0953ad2b (commit)
      from  7162dac1873020d95441f896904803e29e2f27c5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit fafd2dca8f9c8d0e0d98428747174d8a0953ad2b
Author: Bill Erickson <berickxx at gmail.com>
Date:   Fri Sep 20 11:31:16 2019 -0400

    LP1844812 Combobox avoids processing matching entry lists
    
    Teach the combobox to only process newly provided entry lists if they
    are different from the list already on record for the combobox.
    
    The combobox entry list Input() is responsive to changes in data
    throughout the life of the combobox.  As a new entry list is provided,
    the component will perform various actions on the list.  However, in
    many cases the list provided may be identical the list the component
    already has, which can lead to a lot of unnecessary processing and in
    some case an infinite loop of inputs and outputs.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts b/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts
index c98da6cd93..cd33e65187 100644
--- a/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts
+++ b/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts
@@ -109,6 +109,12 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit {
 
     @Input() set entries(el: ComboboxEntry[]) {
         if (el) {
+
+            if (this.entrylistMatches(el)) {
+                // Avoid reprocessing data we already have.
+                return;
+            }
+
             this.entrylist = el;
 
             // new set of entries essentially means a new instance. reset.
@@ -207,6 +213,30 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit {
         setTimeout(() => this.click$.next(''));
     }
 
+    // Returns true if the 2 entries are equivalent.
+    entriesMatches(e1: ComboboxEntry, e2: ComboboxEntry): boolean {
+        return (
+            e1 && e2 &&
+            e1.id === e2.id &&
+            e1.label === e2.label &&
+            e1.freetext === e2.freetext
+        );
+    }
+
+    // Returns true if the 2 lists are equivalent.
+    entrylistMatches(el: ComboboxEntry[]): boolean {
+        if (el.length !== this.entrylist.length) {
+            return false;
+        }
+        for (let i = 0; i < el.length; i++) {
+            const mine = this.entrylist[i];
+            if (!mine || !this.entriesMatches(mine, el[i])) {
+                return false;
+            }
+        }
+        return true;
+    }
+
     // Apply a default selection where needed
     applySelection() {
 

-----------------------------------------------------------------------

Summary of changes:
 .../src/app/share/combobox/combobox.component.ts   | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list