choo121600 commented on code in PR #76483:
URL: https://github.com/apache/airflow/pull/76483#discussion_r4667912449


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/Logs.tsx:
##########
@@ -134,9 +140,36 @@ export const Logs = () => {
     return indices;
   })();
 
+  // Local state keeps the highlighting responsive; the url follows 
(debounced) so the query survives a
+  // tab change and can be shared.
+  const syncSearchParam = useDebouncedCallback((query: string) => {
+    setSearchParams(
+      (params) => {
+        if (query === "") {
+          params.delete(LOG_SEARCH_PARAMS.search);
+        } else {
+          params.set(LOG_SEARCH_PARAMS.search, query);
+        }
+
+        return params;
+      },
+      { replace: true },
+    );
+  }, debounceDelay);
+
+  // Back/Forward can change the url without remounting; adopt it unless a 
typed edit is still pending.
+  if (urlSearchQuery !== lastUrlSearchQuery) {
+    setLastUrlSearchQuery(urlSearchQuery);
+    if (!syncSearchParam.isPending()) {

Review Comment:
   nit: the debounced URL write lands here too and resets the match index 
(Enter right after typing jumps back to the first match).
   
   ```suggestion
       if (!syncSearchParam.isPending() && urlSearchQuery !== searchQuery) {
   ```



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