useGoodMehAndBadInteractionsSamplesQuery.tsx 791 B

12345678910111213141516171819202122232425
  1. import {useInpSpanSamplesWebVitalsQuery} from 'sentry/views/performance/browser/webVitals/utils/queries/useInpSpanSamplesWebVitalsQuery';
  2. import type {InteractionSpanSampleRowWithScore} from 'sentry/views/performance/browser/webVitals/utils/types';
  3. type Props = {
  4. enabled: boolean;
  5. transaction: string;
  6. };
  7. export function useGoodMehAndBadInteractionsSamplesQuery({transaction, enabled}: Props) {
  8. // TODO: Update this function to query good, meh, and bad interactions
  9. const {data, isFetching} = useInpSpanSamplesWebVitalsQuery({
  10. transaction,
  11. enabled,
  12. limit: 9,
  13. });
  14. const interactionsTableData: InteractionSpanSampleRowWithScore[] = data.sort(
  15. (a, b) => a.inpScore - b.inpScore
  16. );
  17. return {
  18. data: interactionsTableData,
  19. isLoading: isFetching,
  20. };
  21. }