pierrejeambrun opened a new pull request, #67284:
URL: https://github.com/apache/airflow/pull/67284
> **Stacked on #67095.** The diff here includes the 7 commits from #67095 —
the only commit relevant to this PR is the top one, ``UI: Use react-query
native error state for bulk action hooks``. Once #67095 merges, GitHub will
auto-clean the diff down to that single commit.
``useBulkTaskInstances`` and ``useBulkDeleteDagRuns`` both kept the same
anti-pattern @bbovenzi flagged on #67095: a ``useState<unknown>`` for the
error, an ``onError`` callback that just forwarded the network error to
``setError``, and a tiny helper that grabbed ``errors[0]`` from the response
body and re-shaped it into ``{body:{detail:...}}`` so ``ErrorAlert`` could
render the first per-entity failure. That hid every error past the first and
duplicated mutation state into React state for no reason.
Both hooks now return ``{ bulkAction, data, error, isPending, reset }``
straight from ``useMutation``:
- ``error`` covers HTTP-level failures (4xx/5xx, network).
- ``data.delete.errors`` / ``data.update.errors`` carries the per-entity
failures the backend returns on a 200 response (partial success). Consumers
render every entry, not just the first.
- ``reset`` replaces the consumer-side ``setError(undefined)`` calls.
``onSuccess`` still invalidates queries unconditionally, fires the toaster +
clears selection when ``success.length > 0``, and only closes the dialog when
``errors.length === 0`` — partial-success keeps the dialog open so the user can
read what failed.
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Opus 4.7)
Generated-by: Claude Code (Opus 4.7) following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
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]