kaxil commented on code in PR #59814:
URL: https://github.com/apache/airflow/pull/59814#discussion_r2651039007
##########
airflow-core/src/airflow/ui/src/pages/Dag/Tasks/Tasks.tsx:
##########
@@ -57,6 +66,52 @@ export const Tasks = () => {
dagId,
});
+ // Extract task IDs for batch fetching task instances
+ const taskIds = data?.tasks.map((task) => task.task_id ?? "").filter((id) =>
id) ?? [];
+
+ // Batch fetch task instances for all tasks in one API call
+ const {
+ data: taskInstancesData,
+ error: taskInstancesError,
+ isFetching: isFetchingTaskInstances,
+ } = useQuery({
+ enabled: Boolean(dagId) && taskIds.length > 0,
+ queryFn: () =>
+ TaskInstanceService.getTaskInstancesBatch({
+ dagId: "~",
+ dagRunId: "~",
+ requestBody: {
+ dag_ids: [dagId],
+ order_by: "-run_after",
Review Comment:
**Please test your changes before creating PRs.** If you're using AI tools
to help with development (which is fine!), you must review and test the
generated code thoroughly. The volume of untested AI-generated PRs creates
significant review burden for maintainers.
To test this properly:
1. Run the UI locally, check the contributing guide on how if unsure!
2. Navigate to a DAG with 200+ tasks
3. Open the Tasks tab and verify it loads without errors
4. Check the browser console and network tab for API calls
Would you like to revise this PR with a working implementation?
--
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]