Fix: prevent search from sending asynchronous requests

This commit is contained in:
apapachristou 2020-10-30 17:51:07 +02:00
parent 45979922d5
commit d043322014
6 changed files with 15 additions and 15 deletions

View File

@ -9,7 +9,7 @@ import { Router } from '@angular/router';
import { DmpStatus } from '../../../core/common/enum/dmp-status';
import { Principal } from '@app/core/model/auth/principal';
import { TranslateService } from '@ngx-translate/core';
import { takeUntil } from 'rxjs/operators';
import { debounceTime, takeUntil } from 'rxjs/operators';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
import { DatasetCopyDialogueComponent } from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
import { FormControl, FormBuilder } from '@angular/forms';
@ -79,7 +79,7 @@ export class DraftsComponent extends BaseComponent implements OnInit {
this.totalCountDraftDatasets.emit(this.datasetDrafts.length);
});
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.pipe(takeUntil(this._destroyed), debounceTime(500))
.subscribe(x => this.refresh());
this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed))

View File

@ -14,7 +14,7 @@ import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog
import { BaseComponent } from '@common/base/base.component';
import { TranslateService } from '@ngx-translate/core';
import * as FileSaver from 'file-saver';
import { takeUntil, map } from 'rxjs/operators';
import { takeUntil, map, debounceTime } from 'rxjs/operators';
import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitation-dialog.component';
import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { DatasetService } from '@app/core/services/dataset/dataset.service';
@ -106,7 +106,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
this.totalCountRecentEdited.emit(this.allRecentActivities.length);
});
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.pipe(takeUntil(this._destroyed), debounceTime(500))
.subscribe(x => this.refresh());
this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed))
@ -129,7 +129,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
this.totalCountRecentEdited.emit(this.allRecentActivities.length);
});
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.pipe(takeUntil(this._destroyed), debounceTime(500))
.subscribe(x => this.refresh());
this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed))

View File

@ -11,7 +11,7 @@ import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { FormControl, FormBuilder } from '@angular/forms';
import { DatasetCopyDialogueComponent } from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
import { MatDialog } from '@angular/material';
import { takeUntil } from 'rxjs/operators';
import { debounceTime, takeUntil } from 'rxjs/operators';
import { Router } from '@angular/router';
import { DatasetWizardService } from '@app/core/services/dataset-wizard/dataset-wizard.service';
import * as FileSaver from 'file-saver';
@ -78,7 +78,7 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
this.totalCountDatasets.emit(this.datasetActivities.length);
});
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.pipe(takeUntil(this._destroyed), debounceTime(500))
.subscribe(x => this.refresh());
this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed))
@ -93,7 +93,7 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
this.totalCountDatasets.emit(this.datasetActivities.length);
});
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.pipe(takeUntil(this._destroyed), debounceTime(500))
.subscribe(x => this.refresh());
this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed))

View File

@ -14,7 +14,7 @@ import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog
import { BaseComponent } from '@common/base/base.component';
import { TranslateService } from '@ngx-translate/core';
import * as FileSaver from 'file-saver';
import { takeUntil, map } from 'rxjs/operators';
import { takeUntil, map, debounceTime } from 'rxjs/operators';
import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitation-dialog.component';
import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { DatasetService } from '@app/core/services/dataset/dataset.service';
@ -100,7 +100,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
// })
});
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.pipe(takeUntil(this._destroyed), debounceTime(500))
.subscribe(x => this.refresh());
this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed))
@ -131,7 +131,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
this.totalCountDmps.emit(this.dmpActivities.length);
});
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.pipe(takeUntil(this._destroyed), debounceTime(500))
.subscribe(x => this.refresh());
this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed))

View File

@ -15,7 +15,7 @@ import { IBreadCrumbComponent } from '@app/ui/misc/breadcrumb/definition/IBreadC
import { BaseComponent } from '@common/base/base.component';
import { TranslateService } from '@ngx-translate/core';
import { Observable, of as observableOf } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { debounceTime, takeUntil } from 'rxjs/operators';
import { ExternalTagEditorModel, DatasetWizardEditorModel } from '../dataset-wizard/dataset-wizard-editor.model';
import { AuthService } from '@app/core/services/auth/auth.service';
import { isNullOrUndefined } from 'util';
@ -135,7 +135,7 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
});
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.pipe(takeUntil(this._destroyed), debounceTime(500))
.subscribe(x => this.controlModified());
this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed))

View File

@ -17,7 +17,7 @@ import { IBreadCrumbComponent } from '@app/ui/misc/breadcrumb/definition/IBreadC
import { BaseComponent } from '@common/base/base.component';
import { TranslateService } from '@ngx-translate/core';
import { Observable, of as observableOf } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { debounceTime, takeUntil } from 'rxjs/operators';
import { GrantService } from "@app/core/services/grant/grant.service";
import { DmpUploadDialogue } from './upload-dialogue/dmp-upload-dialogue.component';
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
@ -180,7 +180,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
});
this.formGroup.get('like').valueChanges
.pipe(takeUntil(this._destroyed))
.pipe(takeUntil(this._destroyed), debounceTime(500))
.subscribe(x => this.controlModified());
this.formGroup.get('order').valueChanges
.pipe(takeUntil(this._destroyed))