bbovenzi opened a new pull request, #76483:
URL: https://github.com/apache/airflow/pull/76483

   Filters set in the grid, gantt, graph or task log panel were dropped every 
time you switched tabs on the dag, run or task instance pages, even though the 
panel they filter stays on screen. Switching between task instances kept them, 
which is what made the bug confusing: it only reset when you moved between tabs 
such as Logs and Details.
   
   ### Cause
   
   `NavTabs` builds each tab link as `to={{ pathname, search }}`, and the 
object form *replaces* the query string rather than merging into it. Task 
instance tabs only pass their own `try_number`, so everything else in the URL 
was lost. Grid links carry the params forward via `stripExecutionParams`, which 
is why switching task instances behaved differently.
   
   The log search had a second problem of its own: it lived in `useState`, so 
the unmount caused by a tab change wiped it even when the URL survived.
   
   ### Change
   
   - `constants/persistentSearchParams.ts` lists the params owned by the 
persistent panel: grid/gantt run filters, graph filters, the task stream filter 
keys, and the task log filters.
   - `NavTabs` copies those params onto every tab link. A param the tab sets 
itself (e.g. `try_number`) wins over the one in the current URL.
   - Table paging and sorting (`limit`, `offset`, `sort`) are deliberately 
**not** carried: they describe one tab's list, and carrying them would open the 
next tab's table on a page it may not have.
   - The log search query moves into the URL as `log_search` (debounced, 
`replace: true`), so it survives tab changes and a filtered log can be shared 
as a link.
   
   ### Worth a look in review
   
   - The grid and the Runs tab table already share the `state` and `run_type` 
keys. Before, switching tabs broke that link; now a grid filter follows you 
onto the Runs tab and applies to its table too.
   - `TaskInstance.test.tsx` previously asserted `log_level` was *dropped* 
across tabs. That assertion came in with #73554 (try number / UUID alignment) 
as an incidental negative control rather than a product decision, so I flipped 
it, and it now asserts that `offset` is dropped instead.
   - Out of scope: `pages/Run/CallbackLogs.tsx` reads the same log params and 
has the same issue, but it renders inside an expanded row on the Callbacks tab 
rather than as a tab of its own.
   
   ### Before / after
   
   Recorded with the same scripted clicks on `main` and on this branch: grid 
filtered to `State: Failed`, then Overview → Details → Code; then a task log 
filtered to INFO and searched for "bundles", then Logs → XCom → Logs.
   
   <!-- Drag filters-before-after-side-by-side.gif here -->
   
   <!-- Drag filters-before-then-after.gif here (larger, one after the other) 
-->
   
   ### Testing
   
   - New `NavTabs.test.tsx`: filters carried onto every tab, repeated values 
preserved, paging/sorting left behind, tab-set params win.
   - New `Logs.test.tsx` case: search query seeded from the URL.
   - `pnpm lint`, `pnpm format` and the full `pnpm test` suite pass (272 files, 
2326 tests).
   - Manually checked against a local api-server with example dags.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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