Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(issues) add profiles for tab clicks #79536

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion static/app/components/tabs/tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,34 @@ import type {
Node,
Orientation,
} from '@react-types/shared';
import * as Sentry from '@sentry/react';

import InteractionStateLayer from 'sentry/components/interactionStateLayer';
import Link from 'sentry/components/links/link';
import {space} from 'sentry/styles/space';

import {tabsShouldForwardProp} from './utils';

function startSentryProfile() {
if (
'requestIdleCallback' in window &&
typeof window.requestIdleCallback === 'function'
) {
// Enables browser profiles for tab clicks
const span = Sentry.startInactiveSpan({
name: 'issues.tab.pointer.down',
op: 'ui.render',
forceTransaction: true,
});

if (span) {
requestIdleCallback(() => {
span.end();
});
}
}
}

interface TabProps extends AriaTabProps {
item: Node<any>;
orientation: Orientation;
Expand Down Expand Up @@ -83,9 +104,9 @@ export const BaseTab = forwardRef(
<TabLink
to={to}
onMouseDown={handleLinkClick}
onPointerDown={handleLinkClick}
orientation={orientation}
tabIndex={-1}
onClick={startSentryProfile}
>
{children}
</TabLink>
Expand All @@ -103,6 +124,7 @@ export const BaseTab = forwardRef(
borderStyle={borderStyle}
ref={ref}
as={as}
onClick={startSentryProfile}
>
{!isSelected && (
<VariantStyledInteractionStateLayer hasSelectedBackground={false} />
Expand All @@ -121,6 +143,7 @@ export const BaseTab = forwardRef(
overflowing={overflowing}
ref={ref}
as={as}
onClick={startSentryProfile}
>
<VariantStyledInteractionStateLayer hasSelectedBackground={false} />
<VariantFocusLayer />
Expand All @@ -137,6 +160,7 @@ export const BaseTab = forwardRef(
overflowing={overflowing}
ref={ref}
as={as}
onClick={startSentryProfile}
>
<InnerWrap>
<StyledInteractionStateLayer
Expand Down
Loading