Skip to content

Commit 51ffde3

Browse files
authored
fix: Not all console.error shows up in session replay play bar annotations (#765)
1 parent d77cb2d commit 51ffde3

File tree

5 files changed

+32
-21
lines changed

5 files changed

+32
-21
lines changed

packages/app/src/DOMPlayer.tsx

+12-11
Original file line numberDiff line numberDiff line change
@@ -513,17 +513,18 @@ export default function DOMPlayer({
513513
No replay available for this session, most likely due to this
514514
session starting and ending in a background tab.
515515
</div>
516-
) : null}
517-
<div
518-
ref={wrapper}
519-
className={cx(styles.domPlayerWrapper, 'overflow-hidden', {
520-
'd-none': isLoading || isBuffering,
521-
started: (replayer.current?.getCurrentTime() ?? 0) > 0,
522-
[styles.domPlayerWrapperPaused]: playerState === 'paused',
523-
})}
524-
>
525-
<div className="player rr-block" ref={playerContainer} />
526-
</div>
516+
) : (
517+
<div
518+
ref={wrapper}
519+
className={cx(styles.domPlayerWrapper, 'overflow-hidden', {
520+
'd-none': isLoading || isBuffering,
521+
started: (replayer.current?.getCurrentTime() ?? 0) > 0,
522+
[styles.domPlayerWrapperPaused]: playerState === 'paused',
523+
})}
524+
>
525+
<div className="player rr-block" ref={playerContainer} />
526+
</div>
527+
)}
527528
</div>
528529
</>
529530
);

packages/app/src/Playbar.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,11 @@ export default function Playbar({
7575
const isError =
7676
event.severity_text?.toLowerCase() === 'error' ||
7777
event.component === 'error' ||
78+
event.component === 'console' ||
7879
statusCode >= 399;
7980

81+
const isSuccess = !isError && statusCode < 400 && statusCode > 99;
82+
8083
return {
8184
id: event.id,
8285
ts: event.startOffset,
@@ -93,6 +96,7 @@ export default function Playbar({
9396
? 'Intercom Chat Opened'
9497
: event.body,
9598
isError,
99+
isSuccess,
96100
};
97101
}) ?? [],
98102
'percentage',

packages/app/src/PlaybarSlider.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as React from 'react';
2-
import { format } from 'date-fns';
32
import { Slider, Tooltip } from '@mantine/core';
43

54
import { useFormatTime } from './useFormatTime';
@@ -12,6 +11,7 @@ export type PlaybarMarker = {
1211
ts: number;
1312
description: string;
1413
isError: boolean;
14+
isSuccess: boolean;
1515
};
1616

1717
type PlaybarSliderProps = {
@@ -60,9 +60,11 @@ export const PlaybarSlider = ({
6060
<div
6161
className={styles.markerDot}
6262
style={{
63-
backgroundColor: mark.isError
64-
? 'var(--mantine-color-red-6)'
65-
: 'var(--mantine-color-gray-6)',
63+
backgroundColor: mark.isSuccess
64+
? 'var(--mantine-color-green-6)'
65+
: mark.isError
66+
? 'var(--mantine-color-red-6)'
67+
: 'var(--mantine-color-gray-6)',
6668
left: `${((mark.ts - min) / (max - min)) * 100}%`,
6769
}}
6870
onClick={() => onChange(mark.ts)}

packages/app/src/SessionSubpanel.tsx

+8-5
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ export default function SessionSubpanel({
314314
[traceSource],
315315
);
316316

317-
const filteredEventsFilter = useMemo(
317+
// Events shown in the highlighted tab
318+
const highlightedEventsFilter = useMemo(
318319
() => ({
319320
type: 'lucene' as const,
320321
condition: `${traceSource.resourceAttributesExpression}.rum.sessionId:"${rumSessionId}"
@@ -363,7 +364,7 @@ export default function SessionSubpanel({
363364
offset: 0,
364365
},
365366
filters: [
366-
filteredEventsFilter,
367+
tab === 'highlighted' ? highlightedEventsFilter : allEventsFilter,
367368
...(where ? [{ type: whereLanguage, condition: where }] : []),
368369
],
369370
}),
@@ -377,7 +378,9 @@ export default function SessionSubpanel({
377378
end,
378379
whereLanguage,
379380
searchedQuery,
380-
filteredEventsFilter,
381+
tab,
382+
highlightedEventsFilter,
383+
allEventsFilter,
381384
where,
382385
],
383386
);
@@ -410,7 +413,7 @@ export default function SessionSubpanel({
410413
offset: 0,
411414
},
412415
filters: [
413-
tab === 'highlighted' ? filteredEventsFilter : allEventsFilter,
416+
tab === 'highlighted' ? highlightedEventsFilter : allEventsFilter,
414417
...(where ? [{ type: whereLanguage, condition: where }] : []),
415418
],
416419
}),
@@ -425,7 +428,7 @@ export default function SessionSubpanel({
425428
whereLanguage,
426429
searchedQuery,
427430
tab,
428-
filteredEventsFilter,
431+
highlightedEventsFilter,
429432
allEventsFilter,
430433
where,
431434
],

packages/app/styles/PlaybarSlider.module.scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@
2525
position: absolute;
2626
top: 0;
2727
margin-left: -1px;
28-
width: 3px;
28+
width: 2px;
2929
height: 8px;
3030
background-color: #333;
3131
border-radius: 1px;
32+
opacity: 0.5;
3233

3334
&:hover {
3435
opacity: 1 !important;

0 commit comments

Comments
 (0)