Skip to content

Re-render only the changed column when Grid summaries stream in - #69917

Merged
pierrejeambrun merged 1 commit into
apache:mainfrom
astronomer:grid-stream-cascade
Jul 16, 2026
Merged

Re-render only the changed column when Grid summaries stream in#69917
pierrejeambrun merged 1 commit into
apache:mainfrom
astronomer:grid-stream-cascade

Conversation

@pierrejeambrun

@pierrejeambrun pierrejeambrun commented Jul 15, 2026

Copy link
Copy Markdown
Member

Second of two stacked PRs improving Dag Grid performance. Stacked on #69912 (the hover-cascade fix) — that PR's commit shows first in this diff, so the change to review here is the second commit.

The Grid streams TI summaries as one NDJSON line per run. Every line replaced the summaries Map and re-rendered Grid, and because useVirtualizer (@tanstack/react-virtual) is on the React Compiler's hardcoded known-incompatible list, the compiler skips optimizing the whole Grid component. So flatNodes and the click handlers took fresh references on every render, and every column re-rendered on every stream line — not just the run whose summary arrived.

This memoizes the values handed down to the columns by hand. That is the escape hatch the compiler's own bailout message points to for incompatible-library APIs (the compiler source string: "TanStack Virtual's useVirtualizer() API returns functions that cannot be memoized safely"). It also drops a redundant immediate stream restart that aborted and reopened the just-opened mount stream on every grid mount with active runs.

Measured on a 20-run × 30-task grid: column re-renders per load dropped 171 → 54 (all now legitimate), grid load render work ~47% lower.

closes: #69531


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.8)

Generated-by: Claude Code (Opus 4.8) following the guidelines

@boring-cyborg boring-cyborg Bot added the area:UI Related to UI/UX. For Frontend Developers. label Jul 15, 2026
@pierrejeambrun

Copy link
Copy Markdown
Member Author

Merge #69912 first, only the last commit is relevant

@pierrejeambrun

Copy link
Copy Markdown
Member Author

Before

Screen.Recording.2026-07-15.at.15.12.52.mov

After

Screen.Recording.2026-07-15.at.15.13.41.mov

@pierrejeambrun
pierrejeambrun marked this pull request as ready for review July 15, 2026 13:13
@pierrejeambrun pierrejeambrun added this to the Airflow 3.3.1 milestone Jul 15, 2026
@pierrejeambrun pierrejeambrun added the backport-to-v3-3-test Backport to v3-3-test label Jul 15, 2026

@bbovenzi bbovenzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

The Dag Grid streams TI summaries as one NDJSON line per run and stores them in
a Map; every line replaced the Map and re-rendered Grid. Because useVirtualizer
(@tanstack/react-virtual) is on the React Compiler's known-incompatible list, the
compiler skips optimizing all of Grid — so flatNodes and the click handlers got
fresh references on every render and every column re-rendered on every line, not
just the run whose summary arrived. On a ~20-run x 30-task grid that was 117
spurious column re-renders per load.

Memoize the values handed down to the columns by hand — the escape hatch the
compiler's own bailout message points to for incompatible-library APIs. Measured
on the same grid: column re-renders per load dropped 171 -> 54 (all legitimate),
grid load render work ~47% lower.

Also drop a redundant immediate stream restart: an unconditional refresh tick
fired the instant the interval effect mounted, aborting and reopening the
just-opened mount stream (an AbortError on every grid mount with active runs).

related: apache#69531
@pierrejeambrun
pierrejeambrun merged commit 93d722e into apache:main Jul 16, 2026
167 of 168 checks passed
@pierrejeambrun
pierrejeambrun deleted the grid-stream-cascade branch July 16, 2026 09:12
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-3-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-3-test PR Link

pierrejeambrun added a commit that referenced this pull request Jul 16, 2026
…eam in (#69917) (#69958)

The Dag Grid streams TI summaries as one NDJSON line per run and stores them in
a Map; every line replaced the Map and re-rendered Grid. Because useVirtualizer
(@tanstack/react-virtual) is on the React Compiler's known-incompatible list, the
compiler skips optimizing all of Grid — so flatNodes and the click handlers got
fresh references on every render and every column re-rendered on every line, not
just the run whose summary arrived. On a ~20-run x 30-task grid that was 117
spurious column re-renders per load.

Memoize the values handed down to the columns by hand — the escape hatch the
compiler's own bailout message points to for incompatible-library APIs. Measured
on the same grid: column re-renders per load dropped 171 -> 54 (all legitimate),
grid load render work ~47% lower.

Also drop a redundant immediate stream restart: an unconditional refresh tick
fired the instant the interval effect mounted, aborting and reopening the
just-opened mount stream (an AbortError on every grid mount with active runs).
(cherry picked from commit 93d722e)


related: #69531

Co-authored-by: Pierre Jeambrun <pierrejbrun@gmail.com>
vatsrahul1001 pushed a commit that referenced this pull request Aug 5, 2026
…eam in (#69917) (#69958)

The Dag Grid streams TI summaries as one NDJSON line per run and stores them in
a Map; every line replaced the Map and re-rendered Grid. Because useVirtualizer
(@tanstack/react-virtual) is on the React Compiler's known-incompatible list, the
compiler skips optimizing all of Grid — so flatNodes and the click handlers got
fresh references on every render and every column re-rendered on every line, not
just the run whose summary arrived. On a ~20-run x 30-task grid that was 117
spurious column re-renders per load.

Memoize the values handed down to the columns by hand — the escape hatch the
compiler's own bailout message points to for incompatible-library APIs. Measured
on the same grid: column re-renders per load dropped 171 -> 54 (all legitimate),
grid load render work ~47% lower.

Also drop a redundant immediate stream restart: an unconditional refresh tick
fired the instant the interval effect mounted, aborting and reopening the
just-opened mount stream (an AbortError on every grid mount with active runs).
(cherry picked from commit 93d722e)


related: #69531

Co-authored-by: Pierre Jeambrun <pierrejbrun@gmail.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-3-test Backport to v3-3-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grid view slow

2 participants