Skip to content

Commit

Permalink
fix: clear items in multi-select ng-select to prevent render issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jrassa committed Apr 25, 2024
1 parent 17ca8a7 commit 4e994e8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/common/multi-select.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export class MultiSelectDirective implements OnInit {
const isOpen = event.term.trim().length > 0;
this.updateIsOpen(isOpen);
});
// Clear the items on clear event. Fixes bug where cleared items are suggested as options.
this.select.clearEvent.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
this.select.itemsList.setItems([]);
});
}

private updateIsOpen(isOpen: boolean) {
Expand Down

0 comments on commit 4e994e8

Please sign in to comment.