himanshuchawla0807-gif commented on PR #76238:
URL: https://github.com/apache/airflow/pull/76238#issuecomment-6652994585

   A remaining case at `42d799fbdbaeec7031da2dd678e63c11b8bd43ea`: a non-filter 
query is treated as a bare landing and replaced with remembered filters. With 
`dags-last-filters` set to `"state=running"`, opening `/dags?name_pattern=etl` 
immediately becomes `/dags?state=running`; the requested Dag-name search is 
lost. `/dags?name_pattern=etl&offset=40&limit=20` and a sort-only link have the 
same behavior. `filterQuery()` excludes those parameters, so `query === ""` 
even though the URL has an explicit query.
   
   I reproduced this with three added cases using your actual hook/MemoryRouter 
harness: **3 fail / 6 existing tests pass** on this head. Restricting 
restoration to `searchParams.size === 0` preserves explicit queries and the 
existing bare-sidebar restoration. With the incremental diff below, the hook, 
DagsFilters integration and useFiltersHandler modules pass **50 tests**; scoped 
ESLint and application TypeScript checks pass. Ran with the PR lockfile and its 
pinned pnpm10.28.1. This is React test-harness evidence, not a live 
Airflow/browser recording or full-suite claim.
   
   <details><summary>Tested incremental diff</summary>
   
   ```diff
   diff --git 
a/airflow-core/src/airflow/ui/src/pages/DagsList/useRememberedFilters.test.tsx 
b/airflow-core/src/airflow/ui/src/pages/DagsList/useRememberedFilters.test.tsx
   index 1801304ddf..6f5ad3727b 100644
   --- 
a/airflow-core/src/airflow/ui/src/pages/DagsList/useRememberedFilters.test.tsx
   +++ 
b/airflow-core/src/airflow/ui/src/pages/DagsList/useRememberedFilters.test.tsx
   @@ -110,6 +110,18 @@ describe("useRememberedFilters", () => {
        expect(result.current.search).toBe("?state=queued");
      });
    
   +  it.each(["name_pattern=etl", "name_pattern=etl&offset=40&limit=20", 
"order_by=-dag_id"])(
   +    "preserves explicit non-filter query %s instead of replacing it with 
remembered filters",
   +    async (query) => {
   +      localStorage.setItem("dags-last-filters", 
JSON.stringify("state=running"));
   +
   +      const { result } = renderRemembered([`/dags?${query}`]);
   +
   +      await waitFor(() => expect(result.current.search).toBe(`?${query}`));
   +      
expect(localStorage.getItem("dags-last-filters")).toBe(JSON.stringify("state=running"));
   +    },
   +  );
   +
      it("keeps a pinned default preset ahead of the remembered filters", () => 
{
        localStorage.setItem("dags-preset-filters-default", 
JSON.stringify("Pinned"));
        localStorage.setItem("dags-last-filters", 
JSON.stringify("state=running"));
   diff --git 
a/airflow-core/src/airflow/ui/src/pages/DagsList/useRememberedFilters.ts 
b/airflow-core/src/airflow/ui/src/pages/DagsList/useRememberedFilters.ts
   index d4624c60dc..3824e49270 100644
   --- a/airflow-core/src/airflow/ui/src/pages/DagsList/useRememberedFilters.ts
   +++ b/airflow-core/src/airflow/ui/src/pages/DagsList/useRememberedFilters.ts
   @@ -81,7 +81,7 @@ export const useRememberedFilters = (
    
          if (userEdited) {
            setLastFilters("");
   -      } else if (defaultPresetName === null) {
   +      } else if (defaultPresetName === null && searchParams.size === 0) {
            const remembered = filterQuery(lastFilters, filterParams);
    
            if (remembered !== "") {
   ```
   </details>
   
   Codex generated and executed this reproduction/correction; no personal human 
review is claimed. No competing PR or push to your branch.


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