bbovenzi commented on code in PR #25610:
URL: https://github.com/apache/airflow/pull/25610#discussion_r942904951


##########
airflow/www/static/js/dag/details/taskInstance/index.tsx:
##########
@@ -54,18 +52,41 @@ const dagId = getMetaValue('dag_id')!;
 interface Props {
   taskId: Task['id'];
   runId: DagRun['runId'];
+  mapIndex: TaskInstanceType['mapIndex'];
+  onSelect: (selectionProps: SelectionProps) => void;
 }
 
-const TaskInstance = ({ taskId, runId }: Props) => {
-  const [selectedRows, setSelectedRows] = useState<number[]>([]);
+const TaskInstance = ({
+  taskId, runId, mapIndex, onSelect,
+}: Props) => {
+  const isMapIndexDefined = !(mapIndex === undefined);
+  const selectedRows: number[] = isMapIndexDefined ? [mapIndex] : [];
   const { data: { dagRuns, groups } } = useGridData();
 
   const storageTabIndex = 
parseInt(localStorage.getItem(detailsPanelActiveTabIndex) || '0', 10);
   const [preferedTabIndex, setPreferedTabIndex] = useState(storageTabIndex);
 
+  const [instance, setInstance] = useState<TaskInstanceType>();
+
   const group = getTask({ taskId, task: groups });
   const run = dagRuns.find((r) => r.runId === runId);
 
+  useEffect(() => {
+    if (!isMapIndexDefined) {
+      setInstance(group?.instances.find((ti) => ti.runId === runId));

Review Comment:
   By using a new API endpoint for a single mapped instance, we can remove a 
lot of this `useEffect` logic, add autorefresh, and make sure that navigating 
to this page with `map_index` in the URl, data will load.
   



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