From 9b4821ef04b7dc817a14aad060ab4f15dc9cd2fb Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Tue, 14 Mar 2023 17:42:14 +0100 Subject: [PATCH] fix(admin-ui): Fix navigation to order list component --- .../core/src/providers/breadcrumb/breadcrumb.service.ts | 9 ++++++++- .../src/components/order-list/order-list.component.ts | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/admin-ui/src/lib/core/src/providers/breadcrumb/breadcrumb.service.ts b/packages/admin-ui/src/lib/core/src/providers/breadcrumb/breadcrumb.service.ts index 0934778840..0996a32e9b 100644 --- a/packages/admin-ui/src/lib/core/src/providers/breadcrumb/breadcrumb.service.ts +++ b/packages/admin-ui/src/lib/core/src/providers/breadcrumb/breadcrumb.service.ts @@ -2,7 +2,13 @@ import { Injectable, OnDestroy } from '@angular/core'; import { ActivatedRoute, Data, NavigationEnd, Params, PRIMARY_OUTLET, Router } from '@angular/router'; import { DataService } from '@vendure/admin-ui/core'; import { flatten } from 'lodash'; -import { combineLatest as observableCombineLatest, Observable, of as observableOf, Subject } from 'rxjs'; +import { + combineLatest as observableCombineLatest, + Observable, + of as observableOf, + share, + Subject, +} from 'rxjs'; import { filter, map, startWith, switchMap, takeUntil } from 'rxjs/operators'; export type BreadcrumbString = string; @@ -33,6 +39,7 @@ export class BreadcrumbService implements OnDestroy { takeUntil(this.destroy$), startWith(true), switchMap(() => this.generateBreadcrumbs(this.route.root)), + share(), ); } diff --git a/packages/admin-ui/src/lib/order/src/components/order-list/order-list.component.ts b/packages/admin-ui/src/lib/order/src/components/order-list/order-list.component.ts index 2e6a6a2645..3655e0f34c 100644 --- a/packages/admin-ui/src/lib/order/src/components/order-list/order-list.component.ts +++ b/packages/admin-ui/src/lib/order/src/components/order-list/order-list.component.ts @@ -115,10 +115,6 @@ export class OrderListComponent this.route.snapshot.queryParamMap.get('filter') || 'open', ), ); - const lastFilters = this.localStorageService.get('orderListLastCustomFilters'); - if (lastFilters) { - this.setQueryParam(lastFilters, { replaceUrl: true }); - } this.canCreateDraftOrder = !!this.serverConfigService .getOrderProcessStates() .find(state => state.name === 'Created') @@ -130,6 +126,10 @@ export class OrderListComponent ngOnInit() { super.ngOnInit(); + const lastFilters = this.localStorageService.get('orderListLastCustomFilters'); + if (lastFilters) { + this.setQueryParam(lastFilters, { replaceUrl: true }); + } this.activePreset$ = this.route.queryParamMap.pipe( map(qpm => qpm.get('filter') || 'open'), distinctUntilChanged(),