[develop | DONE | FIXED]: [BUG FIX] searchAll.component.ts: Tabs did not change if changed entity via menu & queryparams changes emit before params change - used combineLatest and debounceTime(0) as a workaround.
This commit is contained in:
parent
f43025b21c
commit
49cd8a6232
|
@ -23,7 +23,8 @@ import {EnvProperties} from '../../utils/properties/env-properties';
|
|||
import {SEOService} from '../../sharedComponents/SEO/SEO.service';
|
||||
import {StringUtils} from '../../utils/string-utils.class';
|
||||
import {SearchCustomFilter} from "../searchUtils/searchUtils.class";
|
||||
import {Subscription} from "rxjs";
|
||||
import {combineLatest, Subscription} from "rxjs";
|
||||
import {debounceTime, map} from "rxjs/operators";
|
||||
import {AdvancedField, Filter} from "../searchUtils/searchHelperClasses.class";
|
||||
import {SearchResearchResultsComponent} from "../searchResearchResults.component";
|
||||
import {SearchProjectsComponent} from "../searchProjects.component";
|
||||
|
@ -219,9 +220,14 @@ export class SearchAllComponent {
|
|||
|
||||
loadAll() {
|
||||
this.reloadTabs();
|
||||
// https://github.com/angular/angular/issues/26764
|
||||
this.subs.push(combineLatest([this.route.params, this.route.queryParams])
|
||||
.pipe(debounceTime(0))
|
||||
.pipe(map(results => ({params: results[0], query: results[1]})))
|
||||
.subscribe(results => {
|
||||
let params = results['params'];
|
||||
let queryParams = results['query'];
|
||||
|
||||
this.subs.push(this.route.params.subscribe(params => {
|
||||
this.subs.push(this.route.queryParams.subscribe(queryParams => {
|
||||
this.parameters = Object.assign({}, queryParams);
|
||||
this.keyword = (queryParams['keyword']) ? queryParams['keyword'] : (queryParams["q"] ? queryParams["q"] : (queryParams["f0"] && queryParams["f0"] == "q" && queryParams["fv0"]?queryParams["fv0"]:""));
|
||||
this.selectedFields[0].value = StringUtils.URIDecode(this.keyword);
|
||||
|
@ -237,9 +243,8 @@ export class SearchAllComponent {
|
|||
active = ((["result","projects","organizations","datasources","services"]).indexOf(queryParams["active"])!= -1)?queryParams["active"]:null;
|
||||
delete this.parameters['active'];
|
||||
}
|
||||
|
||||
if(this.activeEntity == null) {
|
||||
if (this.activeEntity == null && (!params["entity"] || params["entity"].length == 0)) {
|
||||
// if(this.activeEntity == null) {
|
||||
if (this.activeEntity == null && (!params["entity"] || params["entity"].length == 0) && (!active || this.activeEntity != active)) {
|
||||
if (active) {
|
||||
this.activeEntity = active;
|
||||
if ((typeof document !== 'undefined')) {
|
||||
|
@ -261,7 +266,7 @@ export class SearchAllComponent {
|
|||
}
|
||||
this.activeEntity = ((["result", "projects", "organizations", "datasources", "services"]).indexOf(entity) != -1) ? entity : this.getDefaultEntityToShow();
|
||||
}
|
||||
}
|
||||
// }
|
||||
if (this.activeEntity == "result") {
|
||||
this.searchResults();
|
||||
} else if (this.activeEntity == "projects") {
|
||||
|
@ -274,7 +279,7 @@ export class SearchAllComponent {
|
|||
this.searchOrganizations();
|
||||
}
|
||||
this.count();
|
||||
}));
|
||||
// }));
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue