Skip to content
38 changes: 38 additions & 0 deletions static/app/components/feedback/feedbackItem/feedbackItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import type {Event} from 'sentry/types/event';
import type {Group} from 'sentry/types/group';
import type {FeedbackIssue} from 'sentry/utils/feedback/types';
import useOrganization from 'sentry/utils/useOrganization';
import {TraceDataSection as IssueDetailsTraceDataSection} from 'sentry/views/issueDetails/traceDataSection';
import {useTraceTimelineEvents} from 'sentry/views/issueDetails/traceTimeline/useTraceTimelineEvents';

interface Props {
eventData: Event | undefined;
Expand Down Expand Up @@ -59,6 +61,14 @@ export default function FeedbackItem({feedbackItem, eventData, tags}: Props) {
<MessageSection eventData={eventData} feedbackItem={feedbackItem} />
</Section>

{eventData ? (
<TraceDataSection
eventData={eventData}
crashReportId={crashReportId}
hasProject={!!feedbackItem.project}
/>
) : null}

{!crashReportId || (crashReportId && url) ? (
<Section icon={<IconLink size="xs" />} title={t('URL')}>
<TextCopyInput
Expand Down Expand Up @@ -122,6 +132,34 @@ export default function FeedbackItem({feedbackItem, eventData, tags}: Props) {
);
}

function TraceDataSection({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move this to a new file? similar to how the other sections are structured

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm I feel like it's small enough to keep here, it's basically a wrapper around Issue's TraceDataSection

eventData,
crashReportId,
hasProject,
}: {
crashReportId: string | undefined;
eventData: Event;
hasProject: boolean;
}) {
// If there's a linked error from a crash report and only one other issue, showing both could be redundant.
// TODO: we could add a jest test .spec for this ^
const {oneOtherIssueEvent, traceEvents, isLoading, isError} = useTraceTimelineEvents({
event: eventData,
});
const hide: boolean =
isLoading ||
isError ||
traceEvents.length <= 1 || // traceEvents include the current event.
(hasProject && !!crashReportId && oneOtherIssueEvent?.id === crashReportId);

// Note a timeline will only be shown for >1 same-trace issues.
return hide ? null : (
<Section>
<IssueDetailsTraceDataSection event={eventData} />
</Section>
);
}

// 0 padding-bottom because <ActivitySection> has space(2) built-in.
const OverflowPanelItem = styled(PanelItem)`
overflow: auto;
Expand Down