Connect Breadcrumb to Catalog Search

This commit is contained in:
Lorenz Hilpert
2021-05-27 11:03:47 +02:00
parent d71e30bedc
commit c8e0457b67

View File

@@ -56,15 +56,25 @@ export class ArticleSearchResultsComponent implements OnInit, OnDestroy {
const items = this.cache.get<ItemDTO[]>(params);
if (items) {
this.store.setItems({ items });
} else {
this.store.search({ reload: true });
}
this.store.search({ reload: true });
const scrollPos = Number(original?.scrollPos);
if (scrollPos !== null) {
this.scrollTop(scrollPos);
}
},
connected: () => {
const { query, queryParams, hits } = this.store;
this.breadcrumb.addOrUpdateBreadcrumbIfNotExists({
key: this.application.activatedProcessId,
name: `${query} (${hits ? hits : 'Lade'} Ergebnisse)`,
path: '/product/search/results',
params: queryParams,
tags: ['catalog', 'filter', 'results'],
});
},
disconnected: () => {
this.cache.set(this.store.queryParams, this.store.items);
this.updateBreadcrumbs(previousProcessId, {
@@ -73,16 +83,6 @@ export class ArticleSearchResultsComponent implements OnInit, OnDestroy {
});
},
});
const { query, queryParams, hits } = this.store;
this.breadcrumb.addOrUpdateBreadcrumbIfNotExists({
key: this.application.activatedProcessId,
name: `${query} (${hits ? hits : 'Lade'} Ergebnisse)`,
path: '/product/search/results',
params: queryParams,
tags: ['catalog', 'filter', 'results'],
});
}
ngOnDestroy() {