Pushkal-Gupta opened a new pull request, #77726:
URL: https://github.com/apache/airflow/pull/77726
`DataTable` only ever sorts on the server. It sets `manualSorting: true`,
and `getSortedRowModel` appears nowhere in `src/`, so TanStack never reorders
rows itself. A sortable column is therefore only real if the page behind it
sends the sort to the API.
Three tables offer sortable headers with nothing behind them. Clicking one
moves its arrow and the rows stay exactly where they were.
| Table | Sortable headers that do nothing | Why |
| --- | --- | --- |
| `ActionAccordion` | `dag_id`, `task_id`, `state`, `map_index`,
`dag_run_id` | the rows are a prop, there is no query |
| `TaskStateStore` | `key`, `updated_at`, `expires_at` |
`listTaskStateStore` has no `order_by` |
| `AssetStateStore` | `key`, `updated_at` | `listAssetStateStore` has no
`order_by` |
`ActionAccordion` is the one people meet most, since that table is the
affected-tasks list inside every clear and mark-as confirmation dialog, plus
the bulk ones on the Dag Runs and Task Instances pages. Its own file already
says so:
```tsx
// Table is in memory, pagination and sorting are disabled.
// TODO: Make a front-end only unconnected table component with client side
ordering and pagination
```
Sorting was meant to be off here. Five columns just never got the flag, and
the two that did (`select` and `loop_iteration`) sit right beside them.
The two state stores are the same story for a different reason. Neither
endpoint takes an `order_by` at all. `list_task_state_store` hardcodes
`.order_by(TaskStateStoreModel.key.asc())` and passes `order_by=None` to
`paginated_select`, and the page drops `sorting` on the floor when it builds
the query. The `value` column in both files already sets `enableSorting:
false`, so again this lines the rest up with what was already there.
## What this changes
`enableSorting: false` on those ten columns, which is what the columns next
to them already do. The header keeps its label and loses the sort button.
Nothing else moves. The two state stores keep returning entries by key,
which is what they did before.
## What this does not change
Giving the two state-store endpoints a real `order_by` would be the richer
fix, and the column headers would then be worth having. That is an API change
rather than a bug fix, so it is not in here. The `TODO` quoted above already
tracks the other half, a client-side table for in-memory lists like the
dialog's.
## How I found it
Since `DataTable` cannot sort client side, every sortable column needs a
page that sends `orderBy`. Checking that across the tree turned up these three
and nothing else. Every other table either sends the sort or already turns the
column off.
I also checked the opposite direction, every column that offers a sort the
API would refuse, by comparing each table's sortable keys against the
`allowed_attrs` and `to_replace` of the route it calls. That came back clean,
so there is nothing to fix there.
## Verification
Reverting the three source files fails all three new tests and nothing else:
```
× offers no sort, because the rows are held in memory with nothing to
reorder them
AssertionError: expected [ 'dag_id', 'task_id', 'state', ...(2) ] to
deeply equal []
× renders no sort control, since listTaskStateStore cannot order the entries
AssertionError: expected [ <button ...(3)>...(1)</button>, ...(2) ] to
deeply equal []
× renders no sort control, since listAssetStateStore cannot order the entries
AssertionError: expected [ <button ...(3)>...(1)</button>, ...(1) ] to
deeply equal []
```
The first names the five columns. The other two count the sort buttons
actually rendered in the header row, two and three of them, which is the bug on
screen.
The `ActionAccordion` test turns on every optional column, so none of them
can slip past unchecked. The `TaskStateStore` one loads no entries on purpose:
the header row renders either way, and an entry would pull its value over a
second request the test has no reason to stand up.
`taskInstance` in `TaskStateStore.test.tsx` moves out to a module-level
fixture so both tests can use it. No other change to the existing tests, and
the six that were already there still pass.
`oxfmt --check`, `oxlint`, `eslint --quiet` and `tsc` all pass. 33 test
files and 263 tests pass together: the two state stores, `DataTable`,
`ActionAccordion` and every page that renders it. The prek hooks that apply to
these six files pass. No lockfile change.
No newsfragment: this is an ordinary bug fix.
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes - Claude Code (Opus 5)
--
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]