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


##########
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:
   I don't think we should be using `useEffect` here.  The Details component 
should probably get the mapped instance info from the API: 
`/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/{map_index}`



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