Skip to content

Commit

Permalink
[Fix] Existing employee not pre-selected and can be selected twice wh… (
Browse files Browse the repository at this point in the history
#8321)

* [Fix] Existing employee not pre-selected and can be selected twice when editing a task

* use async/await instead of then
  • Loading branch information
samuelmbabhazi authored Oct 3, 2024
1 parent 0cf595f commit dfdf58c
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,7 @@ export class EmployeeSelectComponent implements OnInit, OnDestroy {
public organization: IOrganization = this.store.selectedOrganization;
public selectedDateRange: IDateRangePicker;

ngOnInit(): void {
//delay to pre selected employee
this.loaded = false;
setTimeout(() => {
this.loaded = true;
}, 500);

async ngOnInit(): Promise<void> {
this.changeValue$.pipe(debounceTime(100), untilDestroyed(this)).subscribe((value) => {
this.checkForMultiSelectValue(value);
this.onChange(this.val);
Expand All @@ -122,10 +116,13 @@ export class EmployeeSelectComponent implements OnInit, OnDestroy {
tap(([dateRange]) => {
this.selectedDateRange = dateRange;
}),
tap(() => {
tap(async () => {
if (!this.allEmployees || this.allEmployees.length === 0) {
this.getWorkingEmployees();
await this.getWorkingEmployees();
}

this.select.setValue(this.preSelected);
this.loaded = true;
}),
untilDestroyed(this)
)
Expand Down

0 comments on commit dfdf58c

Please sign in to comment.