index.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import {useContext} from 'react';
  2. import {Location} from 'history';
  3. import Placeholder from 'sentry/components/placeholder';
  4. import {Group, Organization} from 'sentry/types';
  5. import {Event} from 'sentry/types/event';
  6. import {QuickTraceContext} from 'sentry/utils/performance/quickTrace/quickTraceContext';
  7. import IssueQuickTrace from './issueQuickTrace';
  8. type Props = {
  9. event: Event;
  10. group: Group;
  11. location: Location;
  12. organization: Organization;
  13. isPerformanceIssue?: boolean;
  14. };
  15. function QuickTrace({event, organization, location, isPerformanceIssue}: Props) {
  16. const hasPerformanceView = organization.features.includes('performance-view');
  17. const hasTraceContext = Boolean(event.contexts?.trace?.trace_id);
  18. const quickTrace = useContext(QuickTraceContext);
  19. if (!hasPerformanceView || !hasTraceContext) {
  20. return null;
  21. }
  22. if (quickTrace?.isLoading) {
  23. return <Placeholder height="24px" />;
  24. }
  25. return (
  26. <IssueQuickTrace
  27. organization={organization}
  28. event={event}
  29. location={location}
  30. isPerformanceIssue={isPerformanceIssue}
  31. quickTrace={quickTrace}
  32. />
  33. );
  34. }
  35. export default QuickTrace;