import { useQuery } from '@tanstack/react-query'; import { api } from '../client'; export function useCorrelationChain(correlationId: string | null, environment?: string) { return useQuery({ queryKey: ['correlation-chain', correlationId, environment], queryFn: async () => { const { data } = await api.POST('/search/executions', { body: { correlationId: correlationId!, environment, limit: 20, sortField: 'startTime', sortDir: 'asc', }, }); return data; }, enabled: !!correlationId, }); }