useTransaction.tsx 742 B

12345678910111213141516171819202122232425262728
  1. import type {EventTransaction, Organization} from 'sentry/types';
  2. import {useApiQuery} from 'sentry/utils/queryClient';
  3. import type {
  4. TraceTree,
  5. TraceTreeNode,
  6. } from 'sentry/views/performance/newTraceDetails/traceModels/traceTree';
  7. interface UseTransactionProps {
  8. node: TraceTreeNode<TraceTree.Transaction>;
  9. organization: Organization;
  10. }
  11. export function useTransaction(props: UseTransactionProps) {
  12. return useApiQuery<EventTransaction>(
  13. [
  14. `/organizations/${props.organization.slug}/events/${props.node.value.project_slug}:${props.node.value.event_id}/`,
  15. {
  16. query: {
  17. referrer: 'trace-details-summary',
  18. },
  19. },
  20. ],
  21. {
  22. staleTime: 0,
  23. enabled: !!props.node,
  24. }
  25. );
  26. }