[develop | DONE | FIXED ] remove multiple requests on first load of manage projects
This commit is contained in:
parent
82ade5e137
commit
378ea26f83
|
@ -12,7 +12,7 @@ import {ManageCommunityProjectsService} from '../../services/manageProjects.serv
|
|||
import {properties} from "../../../environments/environment";
|
||||
import {Subscriber} from "rxjs";
|
||||
import {UntypedFormBuilder, UntypedFormGroup} from "@angular/forms";
|
||||
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
|
||||
import {debounceTime, distinctUntilChanged, skip} from "rxjs/operators";
|
||||
import {ResultPreview} from "../../openaireLibrary/utils/result-preview/result-preview";
|
||||
import {SearchInputComponent} from "../../openaireLibrary/sharedComponents/search-input/search-input.component";
|
||||
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
|
||||
|
@ -84,7 +84,7 @@ export class AddProjectsComponent implements OnInit {
|
|||
});
|
||||
|
||||
this.subscriptions.push(this.filterForm.get('keyword').valueChanges
|
||||
.pipe(debounceTime(1000), distinctUntilChanged())
|
||||
.pipe(debounceTime(1000), distinctUntilChanged(), skip(1))
|
||||
.subscribe(value => {
|
||||
this.keywordChanged(value);
|
||||
}));
|
||||
|
|
|
@ -19,7 +19,7 @@ import {CommunityInfo} from "../../openaireLibrary/connect/community/communityIn
|
|||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
|
||||
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
|
||||
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
|
||||
import {debounceTime, distinctUntilChanged, skip} from "rxjs/operators";
|
||||
import {IndexInfoService} from "../../openaireLibrary/utils/indexInfo.service";
|
||||
declare var UIkit;
|
||||
|
||||
|
@ -91,13 +91,15 @@ export class RemoveProjectsComponent implements OnInit {
|
|||
sort: this._fb.control(this.sortOptions[0].value)
|
||||
});
|
||||
|
||||
this.subscriptions.push(this.filterForm.get('keyword').valueChanges.pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => {
|
||||
this.subscriptions.push(this.filterForm.get('keyword').valueChanges.pipe(debounceTime(500), distinctUntilChanged(), skip(1)).subscribe(value => {
|
||||
this.page = 1;
|
||||
this._getCommunityProjects(this.page, this.filterForm.get('keyword').value,(this.filterForm.get("funder").value? this.filterForm.get("funder").value.id:null),
|
||||
this.filterForm.get("sort").value.sort );
|
||||
|
||||
}));
|
||||
this.subscriptions.push(this.filterForm.get('sort').valueChanges.subscribe(value => {
|
||||
this.subscriptions.push(this.filterForm.get('sort').valueChanges.pipe(
|
||||
distinctUntilChanged(), skip(1)
|
||||
).subscribe(value => {
|
||||
this.page = 1;
|
||||
this._getCommunityProjects(this.page, this.filterForm.get('keyword').value, this.filterForm.get("funder").value? this.filterForm.get("funder").value.id:null, this.filterForm.get("sort").value.sort );
|
||||
}));
|
||||
|
|
Loading…
Reference in New Issue