Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit 00bb233

Browse files
authored
Fix product id check in process detail (#251)
- null type is object, so correctly added it to as type and check if product is not false.
1 parent 61a752d commit 00bb233

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/pages/ProcessDetail.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,12 @@ function ProcessDetail({ match, query, setQuery }: IProps) {
7878
if (stepUserInput && localStepUserInput) return;
7979
const localTabs = localStepUserInput ? ["user_input", "process"] : ["process"];
8080
const localSelectedTab = localStepUserInput ? "user_input" : "process";
81-
const getProductId = (product: string | { product_id: string }) =>
82-
typeof product === "object" ? product.product_id : product;
81+
const getProductId = (product: string | { product_id: string } | null) =>
82+
product && typeof product === "object" ? product.product_id : product;
8383
const product_id = getProductId(processInstance.product);
84-
setProductName(productNameById(product_id, products));
84+
if (product_id) {
85+
setProductName(productNameById(product_id, products));
86+
}
8587
setCustomerName(organisationNameByUuid(processInstance.customer, organisations));
8688
setProcess(processInstance);
8789
setStepUserInput(localStepUserInput);

src/utils/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export interface Process {
234234
export interface ProcessWithDetails {
235235
id: string;
236236
workflow_name: string;
237-
product: string | { product_id: string };
237+
product: string | { product_id: string } | null;
238238
customer: string;
239239
assignee: Assignee;
240240
last_status: string;

0 commit comments

Comments
 (0)