Merged PR 1762: #4692 Hotfix Undefined Values in Route Url

#4692 Hotfix Undefined Values in Route Url
This commit is contained in:
Nino Righi
2024-03-07 14:33:35 +00:00
committed by Lorenz Hilpert
parent a209d59ea9
commit 8f47163627
2 changed files with 36 additions and 1 deletions

View File

@@ -96,6 +96,10 @@ export class PickupShelfInComponent extends PickupShelfBaseComponent {
const order = await this.detailsStore.order$.pipe(take(1)).toPromise();
if (!order) {
return;
}
if (order?.orderNumber) {
return order?.orderNumber;
}
@@ -110,6 +114,12 @@ export class PickupShelfInComponent extends PickupShelfBaseComponent {
const orderItemSubsetId = this.detailsStore.orderItemSubsetId;
const compartmentInfo = this.detailsStore.compartmentInfo;
// Ticket #4692 - Wenn keine Order vorhanden ist, dann soll Breadcrumb nicht erstellt werden
// Dies kann z.B. passieren bei Datenbankproblemen wenn das Fetchen der Order sehr lange braucht
if (!order) {
return;
}
return this._pickupShelfInNavigationService.detailRoute({
item: {
orderId: order?.id,

View File

@@ -226,15 +226,40 @@ export class ShellSideMenuComponent {
}
}, undefined);
if (!lastCrumb || lastCrumb?.path?.includes('undefined') || lastCrumb?.path?.includes('null')) {
if (!lastCrumb) {
return fallback;
}
// #4692 Return Fallback if Values contain undefined or null values, regardless if path is from type string or array
if (typeof lastCrumb?.path === 'string') {
if (lastCrumb?.path?.includes('undefined') || lastCrumb?.path?.includes('null')) {
return fallback;
}
} else {
let valuesToCheck = [];
for (const value of lastCrumb?.path) {
if (value?.outlets && value?.outlets?.primary && value?.outlets?.side) {
valuesToCheck.push(...Object.values(value?.outlets?.primary), ...Object.values(value?.outlets?.side));
} else {
valuesToCheck.push(value);
}
}
if (this.checkIfArrayContainsUndefinedOrNull(valuesToCheck)) {
return fallback;
}
}
return { path: lastCrumb.path, queryParams: lastCrumb.params };
})
);
}
checkIfArrayContainsUndefinedOrNull(array: any[]) {
return array?.includes(undefined) || array?.includes('undefined') || array?.includes(null) || array?.includes('null');
}
getLastActivatedCustomerProcessId$() {
return this._app.getProcesses$('customer').pipe(
map((processes) => {