jhaabhijeet864 opened a new pull request, #74014:
URL: https://github.com/apache/airflow/pull/74014
<!--
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 (
"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.
-->
### Why this is needed
By default, the DAGs search in the Airflow UI uses a fast prefix search.
Users can toggle the "match anywhere" (substring search) button to refine their
queries. However, this toggle state was previously only stored in
`localStorage`.
This created a major usability gap: if a user filtered the DAGs list using
"match anywhere" and shared that URL with a colleague, the recipient wouldn't
see the same results unless they coincidentally had the "match anywhere" toggle
enabled in their own browser's local storage.
---
### How this solves the problem
This PR introduces the `match_anywhere` URL parameter to properly persist
the toggle state, ensuring reproducible and shareable deep links.
* **Selective Persistence**: We modified the `useAdvancedSearch` React
hook to optionally accept a URL parameter key. This allows the DAGs list search
to sync with the URL without polluting the URL state for all other search bars
across the UI.
* **Deep Linking**: The toggle now reads its initial state from the
`match_anywhere` query parameter (falling back to local storage if absent).
When toggled, it dynamically adds or removes `?match_anywhere=true` from the
URL.
---
### What is unique about this implementation
Rather than globally coupling the `useAdvancedSearch` hook to the URL—which
would have forced *all* search inputs across the application (like XComs, Task
Instances, Events, etc.) to inject "match anywhere" states into the URL—we
implemented a highly targeted approach.
The hook now accepts an optional `searchParamKey` argument. By creating a
new strongly-typed `MATCH_ANYWHERE` property in the `SearchParamsKeys` enum and
passing it strictly to the DAGs list component, we preserve the default clean
URL behavior for the rest of the application while explicitly solving the
deep-linking requirement for the DAGs list.
closes: #73772
--
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]