diff --git a/skyvern-frontend/src/routes/workflows/WorkflowRun.tsx b/skyvern-frontend/src/routes/workflows/WorkflowRun.tsx index 8e9da664..e9f6a686 100644 --- a/skyvern-frontend/src/routes/workflows/WorkflowRun.tsx +++ b/skyvern-frontend/src/routes/workflows/WorkflowRun.tsx @@ -51,8 +51,11 @@ function WorkflowRun() { workflowPermanentId, }); - const { data: workflowRun, isLoading: workflowRunIsLoading } = - useWorkflowRunQuery(); + const { + data: workflowRun, + isLoading: workflowRunIsLoading, + isFetched, + } = useWorkflowRunQuery(); const { data: workflowRunTimeline } = useWorkflowRunTimelineQuery(); @@ -137,7 +140,23 @@ function WorkflowRun() { outputs ?? {}, ); - const fileUrls = workflowRun?.downloaded_file_urls ?? []; + const hasSomeExtractedInformation = Object.values( + aggregatedExtractedInformation, + ).some((value) => value !== null); + + const hasFileUrls = + isFetched && + workflowRun && + workflowRun.downloaded_file_urls && + workflowRun.downloaded_file_urls.length > 0; + const fileUrls = hasFileUrls + ? (workflowRun.downloaded_file_urls as string[]) + : []; + + const showOutputSection = + workflowRunIsFinalized && + (hasSomeExtractedInformation || hasFileUrls) && + workflowRun.status === Status.Completed; return (
@@ -240,7 +259,7 @@ function WorkflowRun() { )}
- {workflowRunIsFinalized && workflowRun.status === Status.Completed && ( + {showOutputSection && (