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


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/Logs.tsx:
##########
@@ -118,6 +118,59 @@ export const Logs = () => {
 
   const getLogString = () => getParsedLogs().join("\n");
 
+  const [searchQuery, setSearchQuery] = useState("");
+  const [currentMatchIndex, setCurrentMatchIndex] = useState(0);
+
+  const searchMatchIndices = useMemo(() => {

Review Comment:
   We don't need `useMemo` anymore after upgrading to react 19



##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/Logs.tsx:
##########
@@ -118,6 +118,59 @@ export const Logs = () => {
 
   const getLogString = () => getParsedLogs().join("\n");
 
+  const [searchQuery, setSearchQuery] = useState("");
+  const [currentMatchIndex, setCurrentMatchIndex] = useState(0);
+
+  const searchMatchIndices = useMemo(() => {
+    if (!searchQuery) {
+      return [];
+    }
+    const query = searchQuery.toLowerCase();
+    const lines = parseStreamingLogContent(fetchedData);
+    const textLines = lines.map((line) =>
+      renderStructuredLog({
+        index: 0,
+        logLevelFilters,
+        logLink: "",
+        logMessage: line,
+        renderingMode: "text",
+        showSource,
+        showTimestamp,
+        sourceFilters,
+        translate,
+      }),
+    );
+    const indices: Array<number> = [];
+
+    textLines.forEach((line, index) => {
+      if (line.toLowerCase().includes(query)) {
+        indices.push(index);
+      }
+    });
+
+    return indices;
+  }, [searchQuery, fetchedData, showTimestamp, showSource, logLevelFilters, 
sourceFilters, translate]);
+
+  const handleSearchChange = useCallback(

Review Comment:
   We also do not need useCallback anymore



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