LP#1850547: eg-combobox: handle cases where selectedId gets cleared
authorGalen Charlton <gmc@equinoxinitiative.org>
Wed, 26 Feb 2020 17:04:45 +0000 (12:04 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 3 Sep 2020 15:51:26 +0000 (11:51 -0400)
Sponsored-by: Evergreen Community Development Initiative
Sponsored-by: Georgia Public Library Service
Sponsored-by: Indiana State Library
Sponsored-by: C/W MARS

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Tiffany Little <tlittle@georgialibraries.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>

Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts

index 60ed2f7..fb8b900 100644 (file)
@@ -274,6 +274,11 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie
             }
         });
         if (!firstTime) {
+            if ('selectedId' in changes) {
+                if (!changes.selectedId.currentValue) {
+                    this.selected = null;
+                }
+            }
             if ('idlClass' in changes) {
                 if (!('idlField' in changes)) {
                     // let ngOnInit reset it to the
@@ -283,8 +288,8 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie
                 this.asyncIds = {};
                 this.entrylist.length = 0;
                 this.selected = null;
+                this.ngOnInit();
             }
-            this.ngOnInit();
         }
     }