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


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/TaskLogContent.tsx:
##########
@@ -92,14 +99,55 @@ export const TaskLogContent = ({ error, isLoading, 
logError, parsedLogs, wrap }:
   const showScrollButtons = parsedLogs.length > 1 && contentHeight > 
containerHeight;
 
   useLayoutEffect(() => {
-    if (location.hash && !isLoading) {
-      rowVirtualizer.scrollToIndex(Math.min(Number(hash) + 5, 
parsedLogs.length - 1));
+    if (
+      initialHashRef.current === undefined ||
+      hasScrolledRef.current ||
+      isLoading ||
+      parsedLogs.length === 0
+    ) {
+      return;
+    }
+
+    hasScrolledRef.current = true;
+
+    const targetIndex = Math.max(0, Math.min(parsedLogs.length - 1, 
Number(hash) || 0));
+    const el = parentRef.current;
+
+    if (!el) {
+      rowVirtualizer.scrollToIndex(targetIndex, { align: "start" });
+
+      return;
     }
+
+    const vItem = rowVirtualizer.getVirtualItems().find((virtualRow) => 
virtualRow.index === targetIndex);
+    const approxPerItem = 20;
+    const targetPosition = vItem?.start ?? targetIndex * approxPerItem;

Review Comment:
   +1 let's make this two PRs



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