From 1b26a8259892d0e75a434a27e2c7dcc294620795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Zugmeyer?= Date: Fri, 22 Jan 2021 10:56:03 +0100 Subject: [PATCH] [recorder] set 'hasReplay' to undefined by defaultb This change only affects the recorder with flag `postpone_start_recording`. `session.has_replay` should not be set if the record has not been started, to be consistent with the RUM bundle without recorder. --- packages/rum-core/src/rawRumEvent.types.ts | 2 +- packages/rum-recorder/src/boot/rumRecorderPublicApi.spec.ts | 2 +- packages/rum-recorder/src/boot/rumRecorderPublicApi.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/rum-core/src/rawRumEvent.types.ts b/packages/rum-core/src/rawRumEvent.types.ts index b425d42a92..d78b9d8398 100644 --- a/packages/rum-core/src/rawRumEvent.types.ts +++ b/packages/rum-core/src/rawRumEvent.types.ts @@ -176,5 +176,5 @@ export interface User { export interface CommonContext { user: User context: Context - hasReplay?: boolean + hasReplay?: true } diff --git a/packages/rum-recorder/src/boot/rumRecorderPublicApi.spec.ts b/packages/rum-recorder/src/boot/rumRecorderPublicApi.spec.ts index 38ee85b32f..c16925cb60 100644 --- a/packages/rum-recorder/src/boot/rumRecorderPublicApi.spec.ts +++ b/packages/rum-recorder/src/boot/rumRecorderPublicApi.spec.ts @@ -70,7 +70,7 @@ describe('makeRumRecorderPublicApi', () => { it('if enabled, commonContext.hasReplay should be true only if startSessionRecord is called', () => { enabledFlags = ['postpone_start_recording'] rumGlobal.init(DEFAULT_INIT_CONFIGURATION) - expect(getCommonContext().hasReplay).toBe(false) + expect(getCommonContext().hasReplay).toBeUndefined() rumGlobal.startSessionRecord!() expect(getCommonContext().hasReplay).toBe(true) }) diff --git a/packages/rum-recorder/src/boot/rumRecorderPublicApi.ts b/packages/rum-recorder/src/boot/rumRecorderPublicApi.ts index 79163fda19..e13244c5c4 100644 --- a/packages/rum-recorder/src/boot/rumRecorderPublicApi.ts +++ b/packages/rum-recorder/src/boot/rumRecorderPublicApi.ts @@ -7,7 +7,7 @@ export type StartRecording = typeof startRecording export function makeRumRecorderPublicApi(startRumImpl: StartRum, startRecordingImpl: StartRecording) { const rumRecorderGlobal = makeRumPublicApi((userConfiguration, getCommonContext) => { - let isRecording = false + let isRecording: true | undefined const startRumResult = startRumImpl(userConfiguration, () => ({ ...getCommonContext(),