Closed cnasikas closed 1 month ago
Pinging @elastic/response-ops (Team:ResponseOps)
While doing this refactor I'm taking the occasion to try and standardize the naming and shape of TanStack Query-based hooks in the alerts area.
use + FetchAlerts + Query/Mutation
| | |
hook name of the to highlight the fact
corresponding that it returns a query
fetch function or mutation object
params
for the parameters that contribute to the data fetching and computation of the query key,options
for any options overrides the user wants to apply to the query. The whole query or mutation object, to better standardize the return types across different data fetching hooks and to give the user the freedom to access loading states, refetch functions etc.
The alerts table uses various hooks to make API calls. Most of the hooks are using React Query to perform these API calls, The
useFetchAlerts
anduseFetchBrowserFieldCapabilities
do not. We should migrate the rest of the hook to use React Query.