zachliu commented on code in PR #63273:
URL: https://github.com/apache/airflow/pull/63273#discussion_r2919909935


##########
airflow-core/src/airflow/ui/src/pages/DagsList/useTagFilter.ts:
##########
@@ -0,0 +1,66 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { useSearchParams } from "react-router-dom";
+import { useLocalStorage } from "usehooks-ts";
+
+import { SearchParamsKeys, type SearchParamsKeysType } from 
"src/constants/searchParams";
+
+const { OFFSET, TAGS, TAGS_MATCH_MODE }: SearchParamsKeysType = 
SearchParamsKeys;
+
+type TagMatchMode = "all" | "any";
+
+export const useTagFilter = () => {
+  const [searchParams, setSearchParams] = useSearchParams();
+  const [savedTags, setSavedTags] = useLocalStorage<Array<string>>(TAGS, []);
+  const [savedTagMatchMode, setSavedTagMatchMode] = 
useLocalStorage<TagMatchMode>(TAGS_MATCH_MODE, "any");
+
+  const urlTags = searchParams.getAll(TAGS);
+  const urlMatchMode = searchParams.get(TAGS_MATCH_MODE);
+
+  // URL params take precedence; fall back to localStorage when URL has no 
tags.

Review Comment:
   but isn't relying solely on url params causing the issue in the first place?
   for example, i do a page navigation by clicking the "Dags", the url takes me 
to `.../dags` with no params, i lost all previously set tag filters
   
   <img width="443" height="540" alt="2026-03-11_13-33" 
src="https://github.com/user-attachments/assets/66e88033-8d13-4ee7-8007-d9e33391920c";
 />
   
   



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