Skip to content

Commit 1ce4095

Browse files
committed
refd: Improve breadcrumb handling
1 parent bf154f9 commit 1ce4095

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/integration-tests/utils/replayHelpers.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ function isFullSnapshot(event: RecordingEvent): event is FullRecordingSnapshot {
8585
return event.type === EventType.FullSnapshot;
8686
}
8787

88+
function isCustomSnapshot(event: RecordingEvent): event is RecordingEvent & { data: CustomRecordingEvent } {
89+
return event.type === EventType.Custom;
90+
}
91+
8892
/**
8993
* This returns the replay container (assuming it exists).
9094
* Note that due to how this works with playwright, this is a POJO copy of replay.
@@ -146,10 +150,10 @@ export function getCustomRecordingEvents(resOrReq: Request | Response): CustomRe
146150
}
147151

148152
function getAllCustomRrwebRecordingEvents(recordingEvents: RecordingEvent[]): CustomRecordingEvent[] {
149-
return recordingEvents.filter(event => event.type === 5).map(event => event.data as CustomRecordingEvent);
153+
return recordingEvents.filter(isCustomSnapshot).map(event => event.data);
150154
}
151155

152-
function getReplayBreadcrumbs(recordingEvents: RecordingEvent[], category?: string): Breadcrumb[] {
156+
function getReplayBreadcrumbs(recordingEvents: RecordingSnapshot[], category?: string): Breadcrumb[] {
153157
return getAllCustomRrwebRecordingEvents(recordingEvents)
154158
.filter(data => data.tag === 'breadcrumb')
155159
.map(data => data.payload)

0 commit comments

Comments
 (0)