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

Commit

Permalink
Fix UI Refresh Issue due to product_id Type Variance (#248)
Browse files Browse the repository at this point in the history
* Handle varying product_id types to prevent UI refresh interruptions

* make product comparesion more genaral

---------

Co-authored-by: Mohammad Torkashvand <[email protected]>
  • Loading branch information
torkashvand and Mohammad Torkashvand authored Oct 3, 2023
1 parent 88c4a7c commit d10cc88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/pages/ProcessDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ function ProcessDetail({ match, query, setQuery }: IProps) {
if (stepUserInput && localStepUserInput) return;
const localTabs = localStepUserInput ? ["user_input", "process"] : ["process"];
const localSelectedTab = localStepUserInput ? "user_input" : "process";

setProductName(productNameById(processInstance.product, products));
const getProductId = (product: string | { product_id: string }) =>
typeof product === 'object' ? product : product.product_id;
const product_id = getProductId(processInstance.product);
setProductName(productNameById(product_id, products));
setCustomerName(organisationNameByUuid(processInstance.customer, organisations));
setProcess(processInstance);
setStepUserInput(localStepUserInput);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export interface Process {
export interface ProcessWithDetails {
id: string;
workflow_name: string;
product: string;
product: string | { product_id: string };
customer: string;
assignee: Assignee;
last_status: string;
Expand Down

0 comments on commit d10cc88

Please sign in to comment.