antonio-mello-ai commented on code in PR #63467:
URL: https://github.com/apache/airflow/pull/63467#discussion_r2933447498
##########
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:
Done — removed `useMemo` and converted `searchMatchIndices` to a plain
function call. The computation now runs directly on each render without
memoization.
##########
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:
Done — removed `useCallback` from `handleSearchChange`, `handleSearchNext`,
and `handleSearchPrevious`. All three are now plain arrow functions.
--
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]