Alwaysgaurav1 opened a new pull request, #69617:
URL: https://github.com/apache/airflow/pull/69617

   ### Description
   
   This PR resolves the Grid View performance slowness and interaction lag by 
addressing two main performance bottlenecks:
   
   1. **Redundant HTTP/NDJSON Stream Restarts**:
      - In `useGridTISummaries.ts`, setting up the polling interval for 
active/pending runs was executing an immediate `setRefreshTick((tick) => tick + 
1)`.
      - This state update immediately aborted the stream connection that was 
just established, resulting in a redundant second connection attempt and 
throwing cancelled request warnings (`AbortError`) in the console on every grid 
mount/refresh.
      - Removed the immediate `setRefreshTick` execution from the active run 
`useEffect` setup.
   
   2. **Cascading Re-renders from Hover Context Propagation**:
      - Previously, the grid cells (`GridTI`), columns (`TaskInstancesColumn`), 
and header bars (`Bar`) consumed the `hoveredRunId` and `hoveredTaskId` states 
directly from the `useHover` context.
      - Any hover event caused the entire context value to change, triggering a 
cascading virtual DOM reconciliation and re-rendering of the entire grid (up to 
1,200+ elements for moderate-sized DAGs).
      - Refactored `TaskInstancesColumn`, `Bar`, and `TaskNames` to utilize 
wrapper components that consume context and pass down stable computed boolean 
props (like `isHovered`) to memoized inner components 
(`TaskInstancesColumnInner`, `BarInner`, `TaskNamesInner`).
      - Deep-compared `@tanstack/react-virtual`'s `virtualItems` arrays to 
prevent columns/rows from re-rendering unless the visible scrolling range 
shifts.
      - Wrapped `GridTI` in `React.memo` and removed the context subscription, 
rendering cells selectively only if they are on the actively hovered task row.
   
   These changes combined reduce total rendering work in the Grid view by 
**over 90%** during interactions.
   
   ---
   
   ### Links
   
   closes: #69531
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes: Antigravity
   
   Generated-by: Antigravity following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
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