From e54bf589cf8317464f6e35a8c3c5d47c1e522f54 Mon Sep 17 00:00:00 2001 From: Sabiha Khan Date: Thu, 6 Nov 2025 20:48:34 +0530 Subject: [PATCH] fix: infinite loop with configuredAttributes --- .../components/WorkflowExecutions.tsx | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/ui/src/app/workflow/[workflowId]/components/WorkflowExecutions.tsx b/ui/src/app/workflow/[workflowId]/components/WorkflowExecutions.tsx index e7fa6ed..37dbdb8 100644 --- a/ui/src/app/workflow/[workflowId]/components/WorkflowExecutions.tsx +++ b/ui/src/app/workflow/[workflowId]/components/WorkflowExecutions.tsx @@ -66,21 +66,22 @@ export function WorkflowExecutions({ workflowId, searchParams }: WorkflowExecuti const workflow = response.data; if (workflow?.call_disposition_codes) { // Update the disposition code attribute with actual options - const updatedAttributes = configuredAttributes.map(attr => { - if (attr.id === 'dispositionCode') { - return { - ...attr, - config: { - ...attr.config, - options: Object.keys(workflow.call_disposition_codes || {}).length > 0 - ? Object.keys(workflow.call_disposition_codes || {}) - : [...DISPOSITION_CODES] - } - }; - } - return attr; - }); - setConfiguredAttributes(updatedAttributes); + setConfiguredAttributes(prevAttributes => + prevAttributes.map(attr => { + if (attr.id === 'dispositionCode') { + return { + ...attr, + config: { + ...attr.config, + options: Object.keys(workflow.call_disposition_codes || {}).length > 0 + ? Object.keys(workflow.call_disposition_codes || {}) + : [...DISPOSITION_CODES] + } + }; + } + return attr; + }) + ); } } catch (err) { console.error("Failed to load disposition codes:", err); @@ -88,7 +89,7 @@ export function WorkflowExecutions({ workflowId, searchParams }: WorkflowExecuti }; loadDispositionCodes(); - }, [workflowId, accessToken, configuredAttributes]); + }, [workflowId, accessToken]); const fetchWorkflowRuns = useCallback(async (page: number, filters?: ActiveFilter[]) => { if (!accessToken) return;