From 9d57bb938910cfcab78988f6a9b5abf6c24e68c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien=20De=CC=81le=CC=80ze?= Date: Fri, 5 Mar 2021 14:14:26 +0100 Subject: [PATCH] search: fix second filter selection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixes second filter selection, which did not launch the search. This was caused by the search parameters subject which sends the original object instead of a copied one. * Closes rero/rero-ils#1684. Co-Authored-by: Sébastien Délèze --- .../ng-core/src/lib/record/search/record-search.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/rero/ng-core/src/lib/record/search/record-search.component.ts b/projects/rero/ng-core/src/lib/record/search/record-search.component.ts index 39a49e00..e76949f5 100644 --- a/projects/rero/ng-core/src/lib/record/search/record-search.component.ts +++ b/projects/rero/ng-core/src/lib/record/search/record-search.component.ts @@ -17,6 +17,7 @@ import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core'; import { FormlyFieldConfig } from '@ngx-formly/core'; import { TranslateService } from '@ngx-translate/core'; +import { cloneDeep } from 'lodash-es'; import { NgxSpinnerService } from 'ngx-spinner'; import { BehaviorSubject, Observable, of, Subscription } from 'rxjs'; import { distinctUntilChanged, map, switchMap } from 'rxjs/operators'; @@ -317,7 +318,9 @@ export class RecordSearchComponent implements OnInit, OnChanges, OnDestroy { if (resetPage) { this.page = 1; } - this._searchParameters.next(this._serializeSearchParameters()); + // Deep copy is sent, to avoid the reference (source object) to be + // accidentally changed. + this._searchParameters.next(cloneDeep(this._serializeSearchParameters())); } /**