11import  {  Component ,  EventEmitter ,  Input ,  Output  }  from  "@angular/core" ; 
22import  {  createSuggestionObserver ,  getFacetCount  }  from  "./utils" ; 
3- import  {  BehaviorSubject ,  Observable  }  from  "rxjs" ; 
3+ import  {  BehaviorSubject ,  Observable ,   of  }  from  "rxjs" ; 
44import  {  ClearableInputComponent  }  from  "./clearable-input.component" ; 
55import  {  AppConfigService  }  from  "app-config.service" ; 
66import  {  FacetCount  }  from  "state-management/state/datasets.store" ; 
@@ -22,8 +22,8 @@ export class MultiSelectFilterComponent extends ClearableInputComponent {
2222  @Input ( )  key  =  "" ; 
2323  @Input ( )  label  =  "" ; 
2424  @Input ( )  tooltip  =  "" ; 
25-   @Input ( )  facetCounts$ : Observable < FacetCount [ ] > ; 
26-   @Input ( )  currentFilter$ : Observable < string [ ] > ; 
25+   @Input ( )  facetCounts$ : Observable < FacetCount [ ] >   =   of ( [ ] ) ; 
26+   @Input ( )  currentFilter$ : Observable < string [ ] >   =   of ( [ ] ) ; 
2727  @Output ( )  selectionChange  =  new  EventEmitter < MultiSelectFilterValue > ( ) ; 
2828
2929  appConfig  =  this . appConfigService . getConfig ( ) ; 
@@ -53,14 +53,17 @@ export class MultiSelectFilterComponent extends ClearableInputComponent {
5353  } 
5454
5555  itemSelected ( value : {  _id : string ;  label ?: string  }  |  null )  { 
56-     this . selectionChange . emit ( {  key : this . key ,  value :  value ,  event : "add"  } ) ; 
56+     this . selectionChange . emit ( {  key : this . key ,  value,  event : "add"  } ) ; 
5757    this . input$ . next ( "" ) ; 
5858  } 
5959
6060  itemRemoved ( value : string  |  null )  { 
61+     // This is workaround since the currentFilter$ only contains the id string 
62+     const  valueObj  =  {  _id : value  } ; 
63+ 
6164    this . selectionChange . emit ( { 
6265      key : this . key , 
63-       value : {   _id :  value   } , 
66+       value : valueObj , 
6467      event : "remove" , 
6568    } ) ; 
6669  } 
0 commit comments