diff --git a/frontend/src/scenes/session-recordings/__mocks__/recording_snapshots.ts b/frontend/src/scenes/session-recordings/__mocks__/recording_snapshots.ts index 11b40c149c9aa..9cc60a88fb8e4 100644 --- a/frontend/src/scenes/session-recordings/__mocks__/recording_snapshots.ts +++ b/frontend/src/scenes/session-recordings/__mocks__/recording_snapshots.ts @@ -1,5 +1,5 @@ import { eventWithTime } from '@rrweb/types' -import { prepareRecordingSnapshots } from 'scenes/session-recordings/player/sessionRecordingDataLogic' +import { deduplicateSnapshots } from 'scenes/session-recordings/player/sessionRecordingDataLogic' import { RecordingSnapshot } from '~/types' @@ -27,7 +27,7 @@ export const convertSnapshotsResponse = ( snapshotsByWindowId: { [key: string]: eventWithTime[] }, existingSnapshots?: RecordingSnapshot[] ): RecordingSnapshot[] => { - return prepareRecordingSnapshots(convertSnapshotsByWindowId(snapshotsByWindowId), existingSnapshots) + return deduplicateSnapshots(convertSnapshotsByWindowId(snapshotsByWindowId), existingSnapshots) } export const sortedRecordingSnapshots = (): { snapshot_data_by_window_id: Record } => { diff --git a/frontend/src/scenes/session-recordings/file-playback/sessionRecordingFilePlaybackLogic.ts b/frontend/src/scenes/session-recordings/file-playback/sessionRecordingFilePlaybackLogic.ts index 652053e746dda..785374f147298 100644 --- a/frontend/src/scenes/session-recordings/file-playback/sessionRecordingFilePlaybackLogic.ts +++ b/frontend/src/scenes/session-recordings/file-playback/sessionRecordingFilePlaybackLogic.ts @@ -14,8 +14,8 @@ import { urls } from 'scenes/urls' import { Breadcrumb, PersonType, RecordingSnapshot, ReplayTabs, SessionRecordingType } from '~/types' import { + deduplicateSnapshots, parseEncodedSnapshots, - prepareRecordingSnapshots, sessionRecordingDataLogic, } from '../player/sessionRecordingDataLogic' import type { sessionRecordingDataLogicType } from '../player/sessionRecordingDataLogicType' @@ -177,7 +177,7 @@ export const sessionRecordingFilePlaybackLogic = kea { expect(snapshotsWithDuplicates.length).toEqual(snapshots.length + 2) - expect(prepareRecordingSnapshots(snapshots)).toEqual(prepareRecordingSnapshots(snapshotsWithDuplicates)) + expect(deduplicateSnapshots(snapshots)).toEqual(deduplicateSnapshots(snapshotsWithDuplicates)) }) it('should cope with two not duplicate snapshots with the same timestamp and delay', () => { @@ -326,13 +326,13 @@ describe('sessionRecordingDataLogic', () => { }, ] // we call this multiple times and pass existing data in, so we need to make sure it doesn't change - expect(prepareRecordingSnapshots(verySimilarSnapshots, verySimilarSnapshots)).toEqual(verySimilarSnapshots) + expect(deduplicateSnapshots(verySimilarSnapshots, verySimilarSnapshots)).toEqual(verySimilarSnapshots) }) it('should match snapshot', () => { const snapshots = convertSnapshotsByWindowId(sortedRecordingSnapshotsJson.snapshot_data_by_window_id) - expect(prepareRecordingSnapshots(snapshots)).toMatchSnapshot() + expect(deduplicateSnapshots(snapshots)).toMatchSnapshot() }) }) diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts index ea6a4abadc82d..eca6a79458e59 100644 --- a/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts +++ b/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts @@ -149,7 +149,7 @@ function getSnapshotSortingTimestamp(e: eventWithTime | undefined): number | und return e.timestamp } -export const prepareRecordingSnapshots = ( +export const deduplicateSnapshots = ( newSnapshots?: RecordingSnapshot[], existingSnapshots?: RecordingSnapshot[] ): RecordingSnapshot[] => { @@ -237,7 +237,7 @@ async function processEncodedResponse( ): Promise<{ transformed: RecordingSnapshot[]; untransformed: RecordingSnapshot[] | null }> { let untransformed: RecordingSnapshot[] | null = null - const transformed = prepareRecordingSnapshots( + const transformed = deduplicateSnapshots( await parseEncodedSnapshots( encodedResponse, props.sessionRecordingId, @@ -247,7 +247,7 @@ async function processEncodedResponse( ) if (featureFlags[FEATURE_FLAGS.SESSION_REPLAY_EXPORT_MOBILE_DATA]) { - untransformed = prepareRecordingSnapshots( + untransformed = deduplicateSnapshots( await parseEncodedSnapshots( encodedResponse, props.sessionRecordingId,