0
- ? getDuration(traceNode.space[1] / 1e3, 2, true)
+ props.representativeTransaction
+ ? getDuration(
+ props.representativeTransaction.timestamp -
+ props.representativeTransaction.start_timestamp,
+ 2,
+ true
+ )
: '\u2014'
}
/>
diff --git a/static/app/views/performance/newTraceDetails/traceHeader/title.tsx b/static/app/views/performance/newTraceDetails/traceHeader/title.tsx
index e13ad4a635d0fd..6d96899b7ed7b2 100644
--- a/static/app/views/performance/newTraceDetails/traceHeader/title.tsx
+++ b/static/app/views/performance/newTraceDetails/traceHeader/title.tsx
@@ -1,4 +1,4 @@
-import {Fragment, useMemo} from 'react';
+import {Fragment} from 'react';
import styled from '@emotion/styled';
import {CopyToClipboardButton} from 'sentry/components/copyToClipboardButton';
@@ -6,66 +6,20 @@ import ExternalLink from 'sentry/components/links/externalLink';
import {Tooltip} from 'sentry/components/tooltip';
import {t, tct} from 'sentry/locale';
-import {isRootTransaction} from '../../traceDetails/utils';
-import {isTraceNode} from '../traceGuards';
import type {TraceTree} from '../traceModels/traceTree';
-const CANDIDATE_TRACE_TITLE_OPS = ['pageload', 'navigation'];
-
-type TraceTitle = {
- op: string;
- transaction?: string;
-} | null;
-
interface TitleProps {
+ representativeTransaction: TraceTree.Transaction | null;
traceSlug: string;
- tree: TraceTree;
}
-export function Title({traceSlug, tree}: TitleProps) {
- const traceTitle: TraceTitle = useMemo(() => {
- const trace = tree.root.children[0];
-
- if (!trace) {
- return null;
- }
-
- if (!isTraceNode(trace)) {
- throw new TypeError('Not trace node');
- }
-
- let firstRootTransaction: TraceTitle = null;
- let candidateTransaction: TraceTitle = null;
- let firstTransaction: TraceTitle = null;
-
- for (const transaction of trace.value.transactions || []) {
- const title = {
- op: transaction['transaction.op'],
- transaction: transaction.transaction,
- };
-
- // If we find a root transaction, we can stop looking and use it for the title.
- if (!firstRootTransaction && isRootTransaction(transaction)) {
- firstRootTransaction = title;
- break;
- } else if (
- // If we haven't found a root transaction, but we found a candidate transaction
- // with an op that we care about, we can use it for the title. We keep looking for
- // a root.
- !candidateTransaction &&
- CANDIDATE_TRACE_TITLE_OPS.includes(transaction['transaction.op'])
- ) {
- candidateTransaction = title;
- continue;
- } else if (!firstTransaction) {
- // If we haven't found a root or candidate transaction, we can use the first transaction
- // in the trace for the title.
- firstTransaction = title;
+export function Title({traceSlug, representativeTransaction}: TitleProps) {
+ const traceTitle = representativeTransaction
+ ? {
+ op: representativeTransaction['transaction.op'],
+ transaction: representativeTransaction.transaction,
}
- }
-
- return firstRootTransaction ?? candidateTransaction ?? firstTransaction;
- }, [tree.root.children]);
+ : null;
return (
diff --git a/static/app/views/performance/newTraceDetails/traceRow/traceRootNode.tsx b/static/app/views/performance/newTraceDetails/traceRow/traceRootNode.tsx
index 61a51c4c8e28d5..0112bb5b0bd521 100644
--- a/static/app/views/performance/newTraceDetails/traceRow/traceRootNode.tsx
+++ b/static/app/views/performance/newTraceDetails/traceRow/traceRootNode.tsx
@@ -14,12 +14,15 @@ import {
TraceRowConnectors,
type TraceRowProps,
} from '../traceRow/traceRow';
+import {useHasTraceNewUi} from '../useHasTraceNewUi';
const NO_ERRORS = new Set();
const NO_PERFORMANCE_ISSUES = new Set();
const NO_PROFILES = [];
export function TraceRootRow(props: TraceRowProps>) {
+ const hasTraceNewUi = useHasTraceNewUi();
+
if (!isTraceNode(props.node)) {
throw new Error('Trace row rendered called on row that is not root');
}
@@ -77,23 +80,27 @@ export function TraceRootRow(props: TraceRowProps
className={props.spanColumnClassName}
onDoubleClick={props.onRowDoubleClick}
>
-
-
+ {!hasTraceNewUi && (
+
+
+
+
+ )}
);