mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
110889: Fixed trackStatistics still sending backend requests to track search event when trackStatistics is false
This commit is contained in:
@@ -485,18 +485,20 @@ export class SearchComponent implements OnDestroy, OnInit {
|
||||
* This method should only be called once and is essentially what SearchTrackingComponent used to do (now removed)
|
||||
* @private
|
||||
*/
|
||||
private subscribeToRoutingEvents() {
|
||||
this.subs.push(
|
||||
this.router.events.pipe(
|
||||
filter((event) => event instanceof NavigationStart),
|
||||
map((event: NavigationStart) => this.getDsoUUIDFromUrl(event.url)),
|
||||
hasValueOperator(),
|
||||
).subscribe((uuid) => {
|
||||
if (this.resultsRD$.value.hasSucceeded) {
|
||||
this.service.trackSearch(this.searchOptions$.value, this.resultsRD$.value.payload as SearchObjects<DSpaceObject>, uuid);
|
||||
}
|
||||
}),
|
||||
);
|
||||
private subscribeToRoutingEvents(): void {
|
||||
if (this.trackStatistics) {
|
||||
this.subs.push(
|
||||
this.router.events.pipe(
|
||||
filter((event) => event instanceof NavigationStart),
|
||||
map((event: NavigationStart) => this.getDsoUUIDFromUrl(event.url)),
|
||||
hasValueOperator(),
|
||||
).subscribe((uuid) => {
|
||||
if (this.resultsRD$.value.hasSucceeded) {
|
||||
this.service.trackSearch(this.searchOptions$.value, this.resultsRD$.value.payload as SearchObjects<DSpaceObject>, uuid);
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user