Skip to content

Commit

Permalink
[recorder] set 'hasReplay' to undefined by defaultb (#697)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
BenoitZugmeyer authored Jan 22, 2021
1 parent ae87425 commit 3898655
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/rum-core/src/rawRumEvent.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,5 @@ export interface User {
export interface CommonContext {
user: User
context: Context
hasReplay?: boolean
hasReplay?: true
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/rum-recorder/src/boot/rumRecorderPublicApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 3898655

Please sign in to comment.