Merged PR 1620: #4262 Fix HSC Selection Of Branch Dropdown Does Not Clear Main Searchbox Anymore

#4262 Fix HSC Selection Of Branch Dropdown Does Not Clear Main Searchbox Anymore
This commit is contained in:
Nino Righi
2023-09-01 14:44:40 +00:00
committed by Lorenz Hilpert
parent f8a2166967
commit 5167ba21a6
2 changed files with 12 additions and 6 deletions

View File

@@ -1,9 +1,9 @@
import { Component, ChangeDetectionStrategy, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { BreadcrumbService } from '@core/breadcrumb';
import { debounce, isEqual } from 'lodash';
import { BehaviorSubject, combineLatest, Observable, Subscription } from 'rxjs';
import { debounceTime, first, map, shareReplay, switchMap } from 'rxjs/operators';
import { isEqual } from 'lodash';
import { combineLatest, Observable, Subscription } from 'rxjs';
import { debounceTime, filter, first, map, switchMap, take } from 'rxjs/operators';
import { CustomerOrderSearchStore } from '../customer-order-search.store';
import { EnvironmentService } from '@core/environment';
import { Filter, FilterInputGroupMainComponent } from '@shared/components/filter';
@@ -17,7 +17,10 @@ import { ApplicationService } from '@core/application';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CustomerOrderSearchMainComponent implements OnInit, OnDestroy {
filter$ = this._customerOrderSearchStore.filter$;
filter$ = this._customerOrderSearchStore.filter$.pipe(
filter((f) => !!f),
take(1)
);
loading$ = this._customerOrderSearchStore.fetching$;

View File

@@ -9,7 +9,7 @@ import {
QueryList,
AfterViewInit,
} from '@angular/core';
import { debounceTime, first, map, shareReplay, switchMap, takeUntil, withLatestFrom } from 'rxjs/operators';
import { debounceTime, filter, first, map, shareReplay, switchMap, take, takeUntil, withLatestFrom } from 'rxjs/operators';
import { KeyValueDTOOfStringAndString, OrderItemListItemDTO } from '@swagger/oms';
import { ActivatedRoute, Params } from '@angular/router';
import { CustomerOrderSearchStore } from '../customer-order-search.store';
@@ -99,7 +99,10 @@ export class CustomerOrderSearchResultsComponent extends ComponentStore<Customer
private _searchResultSubscription = new Subscription();
filter$ = this._customerOrderSearchStore.filter$;
filter$ = this._customerOrderSearchStore.filter$.pipe(
filter((f) => !!f),
take(1)
);
hasFilter$ = combineLatest([this.filter$, this._customerOrderSearchStore.defaultSettings$]).pipe(
map(([filter, defaultFilter]) => !isEqual(filter?.getQueryParams(), Filter.create(defaultFilter).getQueryParams()))