Skip to content

Commit eb40d63

Browse files
authored
fix(replay): Navigation away from replay details causes rrweb errors (#102877)
When clicking a breadcrumb to navigate away from replay view (e.g. clicking on error link), it triggers click handlers for setting the player timestamp. This causes a lot of rrweb warnings/errors as it tries to play after the replayer is destroyed since we are navigating away. Note there may be more instances of this bug, for now this only addresses Issue breadcrumbs.
1 parent f4c6956 commit eb40d63

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

static/app/components/replays/breadcrumbs/breadcrumbIssueLink.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {useCallback, type MouseEvent} from 'react';
12
import styled from '@emotion/styled';
23

34
import {ProjectAvatar} from 'sentry/components/core/avatar/projectAvatar';
@@ -25,6 +26,9 @@ function CrumbErrorIssue({frame}: {frame: FeedbackFrame | ErrorFrame}) {
2526
const organization = useOrganization();
2627
const project = useProjectFromSlug({organization, projectSlug: frame.data.projectSlug});
2728
const {groupId} = useReplayGroupContext();
29+
const handleClick = useCallback((e: MouseEvent<HTMLAnchorElement>) => {
30+
e.stopPropagation();
31+
}, []);
2832

2933
const projectAvatar = project ? <ProjectAvatar project={project} size={16} /> : null;
3034

@@ -41,6 +45,7 @@ function CrumbErrorIssue({frame}: {frame: FeedbackFrame | ErrorFrame}) {
4145
<CrumbIssueWrapper>
4246
{projectAvatar}
4347
<Link
48+
onClick={handleClick}
4449
to={
4550
isFeedbackFrame(frame)
4651
? {

static/app/components/replays/breadcrumbs/errorTitle.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Fragment} from 'react';
1+
import {Fragment, useCallback, type MouseEvent} from 'react';
22
import capitalize from 'lodash/capitalize';
33

44
import {Link} from 'sentry/components/core/link';
@@ -10,6 +10,9 @@ import useOrganization from 'sentry/utils/useOrganization';
1010
export default function CrumbErrorTitle({frame}: {frame: ErrorFrame}) {
1111
const organization = useOrganization();
1212
const {eventId} = useReplayGroupContext();
13+
const handleClick = useCallback((e: MouseEvent<HTMLAnchorElement>) => {
14+
e.stopPropagation();
15+
}, []);
1316

1417
if (eventId === frame.data.eventId) {
1518
return <Fragment>Error: This Event</Fragment>;
@@ -21,6 +24,7 @@ export default function CrumbErrorTitle({frame}: {frame: ErrorFrame}) {
2124
<Fragment>
2225
{capitalize(level)}:{' '}
2326
<Link
27+
onClick={handleClick}
2428
to={`/organizations/${organization.slug}/issues/${frame.data.groupId}/events/${frame.data.eventId}/#replay`}
2529
>
2630
{getShortEventId(frame.data.eventId)}

0 commit comments

Comments
 (0)