Skip to content

ref(replays): add error boundaries around breadcrumb rows #69110

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

Merged
merged 1 commit into from
Apr 17, 2024
Merged
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
130 changes: 67 additions & 63 deletions static/app/components/replays/breadcrumbs/breadcrumbItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import beautify from 'js-beautify';

import ProjectAvatar from 'sentry/components/avatar/projectAvatar';
import {CodeSnippet} from 'sentry/components/codeSnippet';
import ErrorBoundary from 'sentry/components/errorBoundary';
import Link from 'sentry/components/links/link';
import ObjectInspector from 'sentry/components/objectInspector';
import PanelItem from 'sentry/components/panels/panelItem';
Expand Down Expand Up @@ -80,71 +81,74 @@ function BreadcrumbItem({
<IconWrapper color={color} hasOccurred>
{icon}
</IconWrapper>
<CrumbDetails>
<Flex column>
<TitleContainer>
{<Title>{title}</Title>}
{onClick ? (
<TimestampButton
startTimestampMs={startTimestampMs}
timestampMs={frame.timestampMs}
/>
) : null}
</TitleContainer>

{typeof description === 'string' ||
(description !== undefined && isValidElement(description)) ? (
<Description title={description} showOnlyOnOverflow isHoverable>
{description}
</Description>
) : (
<InspectorWrapper>
<ObjectInspector
data={description}
expandPaths={expandPaths}
onExpand={onInspectorExpanded}
theme={{
TREENODE_FONT_SIZE: '0.7rem',
ARROW_FONT_SIZE: '0.5rem',
}}

<ErrorBoundary mini>
<CrumbDetails>
<Flex column>
<TitleContainer>
{<Title>{title}</Title>}
{onClick ? (
<TimestampButton
startTimestampMs={startTimestampMs}
timestampMs={frame.timestampMs}
/>
) : null}
</TitleContainer>

{typeof description === 'string' ||
(description !== undefined && isValidElement(description)) ? (
<Description title={description} showOnlyOnOverflow isHoverable>
{description}
</Description>
) : (
<InspectorWrapper>
<ObjectInspector
data={description}
expandPaths={expandPaths}
onExpand={onInspectorExpanded}
theme={{
TREENODE_FONT_SIZE: '0.7rem',
ARROW_FONT_SIZE: '0.5rem',
}}
/>
</InspectorWrapper>
)}
</Flex>

{'data' in frame && frame.data && 'mutations' in frame.data ? (
<div>
<OpenReplayComparisonButton
replay={replay}
leftTimestamp={frame.offsetMs}
rightTimestamp={
(frame.data.mutations.next?.timestamp ?? 0) -
(replay?.getReplay().started_at.getTime() ?? 0)
}
/>
</InspectorWrapper>
)}
</Flex>

{'data' in frame && frame.data && 'mutations' in frame.data ? (
<div>
<OpenReplayComparisonButton
replay={replay}
leftTimestamp={frame.offsetMs}
rightTimestamp={
(frame.data.mutations.next?.timestamp ?? 0) -
(replay?.getReplay().started_at.getTime() ?? 0)
}
</div>
) : null}

{extraction?.html ? (
<CodeContainer>
<CodeSnippet language="html" hideCopyButton>
{beautify.html(extraction?.html, {indent_size: 2})}
</CodeSnippet>
</CodeContainer>
) : null}

{traces?.flattenedTraces.map((flatTrace, i) => (
<TraceGrid
key={i}
flattenedTrace={flatTrace}
onDimensionChange={onDimensionChange}
/>
</div>
) : null}

{extraction?.html ? (
<CodeContainer>
<CodeSnippet language="html" hideCopyButton>
{beautify.html(extraction?.html, {indent_size: 2})}
</CodeSnippet>
</CodeContainer>
) : null}

{traces?.flattenedTraces.map((flatTrace, i) => (
<TraceGrid
key={i}
flattenedTrace={flatTrace}
onDimensionChange={onDimensionChange}
/>
))}

{isErrorFrame(frame) || isFeedbackFrame(frame) ? (
<CrumbErrorIssue frame={frame} />
) : null}
</CrumbDetails>
))}

{isErrorFrame(frame) || isFeedbackFrame(frame) ? (
<CrumbErrorIssue frame={frame} />
) : null}
</CrumbDetails>
</ErrorBoundary>
</CrumbItem>
);
}
Expand Down