Copilot commented on code in PR #59824:
URL: https://github.com/apache/airflow/pull/59824#discussion_r2648384433


##########
airflow-core/src/airflow/ui/src/pages/Dag/Dag.tsx:
##########
@@ -105,7 +105,10 @@ export const Dag = () => {
   );
 
   const { tabs: processedTabs } = useRequiredActionTabs({ dagId }, tabs, {
-    refetchInterval,
+    refetchInterval:
+      (dag?.active_runs_count ?? 0) > 0 || isStatePending(latestRun?.state)

Review Comment:
   The condition `isStatePending(latestRun?.state)` will return true when 
`latestRun` is undefined (no runs exist), because `isStatePending` returns true 
for undefined/null states. This contradicts the PR's intent to prevent polling 
when there are no active or pending DAG runs.
   
   Consider explicitly checking if `latestRun` exists before calling 
`isStatePending`, for example:
   `(dag?.active_runs_count ?? 0) > 0 || (latestRun && 
isStatePending(latestRun.state))`
   
   This ensures that polling only occurs when there are actual active runs or 
when a latest run exists with a pending state.
   ```suggestion
         (dag?.active_runs_count ?? 0) > 0 || (latestRun && 
isStatePending(latestRun.state))
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to