Skip to content

Fix graph view not auto-refreshing task states during DAG run#65518

Merged
vatsrahul1001 merged 1 commit into
mainfrom
fix/graph-view-not-auto-refreshing-during-dag-run
Apr 20, 2026
Merged

Fix graph view not auto-refreshing task states during DAG run#65518
vatsrahul1001 merged 1 commit into
mainfrom
fix/graph-view-not-auto-refreshing-during-dag-run

Conversation

@vatsrahul1001
Copy link
Copy Markdown
Contributor

Graph view does not refresh task statuses while tasks are running

Before:
image

After:
image

Root cause

Graph.tsx calls useGridTiSummariesStream without the states prop:

// Before
useGridTiSummariesStream({ dagId, runIds: runId ? [runId] : [] });

Inside useGridTiSummariesStream, the auto-refresh interval only starts when hasActiveRuns is true:

const hasActiveRuns = states?.some((state) => isStatePending(state)) ?? false;
Without states, this is always false → the setInterval never fires → after the initial stream completes the graph freezes.

Grid.tsx already passes states correctly — Graph was missing it.

Fix
Fetch the current dag run state via useDagRunServiceGetDagRun (already cached by React Query — no extra network cost) and pass it as states:

// After

const { data: dagRun } = useDagRunServiceGetDagRun(
  { dagId, dagRunId: runId },
  undefined,
  { enabled: Boolean(runId) },
);
useGridTiSummariesStream({
  dagId,
  runIds: runId ? [runId] : [],
  states: dagRun ? [dagRun.state] : undefined,
});

Tests
Added Graph.test.tsx with two cases:

Verifies states is forwarded when a runId is present and the run is active
Verifies states is undefined when no runId is present

-->


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: [Claude following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@boring-cyborg boring-cyborg Bot added the area:UI Related to UI/UX. For Frontend Developers. label Apr 20, 2026
@vatsrahul1001 vatsrahul1001 added the backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch label Apr 20, 2026
Comment thread airflow-core/src/airflow/ui/src/layouts/Details/Graph/Graph.tsx
@vatsrahul1001 vatsrahul1001 force-pushed the fix/graph-view-not-auto-refreshing-during-dag-run branch from 76d7c09 to 66e2344 Compare April 20, 2026 05:34
Copy link
Copy Markdown
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tested and working as expected thanks.

@pierrejeambrun pierrejeambrun added this to the Airflow 3.2.1 milestone Apr 20, 2026
@vatsrahul1001 vatsrahul1001 requested a review from phanikumv April 20, 2026 07:55
@vatsrahul1001 vatsrahul1001 force-pushed the fix/graph-view-not-auto-refreshing-during-dag-run branch from 66e2344 to 72e9cc2 Compare April 20, 2026 08:01
@vatsrahul1001 vatsrahul1001 merged commit 820e9d2 into main Apr 20, 2026
81 checks passed
@vatsrahul1001 vatsrahul1001 deleted the fix/graph-view-not-auto-refreshing-during-dag-run branch April 20, 2026 09:05
github-actions Bot pushed a commit that referenced this pull request Apr 20, 2026
… run (#65518)

(cherry picked from commit 820e9d2)

Co-authored-by: Rahul Vats <43964496+vatsrahul1001@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Backport successfully created: v3-2-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-2-test PR Link

vatsrahul1001 added a commit that referenced this pull request Apr 20, 2026
… run (#65518) (#65522)

(cherry picked from commit 820e9d2)

Co-authored-by: Rahul Vats <43964496+vatsrahul1001@users.noreply.github.com>
vatsrahul1001 added a commit that referenced this pull request Apr 20, 2026
… run (#65518) (#65522)

(cherry picked from commit 820e9d2)

Co-authored-by: Rahul Vats <43964496+vatsrahul1001@users.noreply.github.com>
vatsrahul1001 added a commit that referenced this pull request Apr 20, 2026
… run (#65518) (#65522)

(cherry picked from commit 820e9d2)

Co-authored-by: Rahul Vats <43964496+vatsrahul1001@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers. backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Graph does not seem to refresh properly in 3.2.1rc2

3 participants