Skip to content

Commit

Permalink
no need to config for a property
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Oct 15, 2024
1 parent be17b72 commit 042a7aa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
20 changes: 5 additions & 15 deletions cypress/e2e/session-recording.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ describe('Session recording', () => {
it('captures session events', () => {
start({
options: {
session_recording: {
report_recording_started: true,
},
session_recording: {},
},
decideResponseOverrides: {
isAuthenticated: false,
Expand Down Expand Up @@ -196,9 +194,7 @@ describe('Session recording', () => {
ph.sessionRecording._forceAllowLocalhostNetworkCapture = true
},

session_recording: {
report_recording_started: true,
},
session_recording: {},
},
})

Expand Down Expand Up @@ -291,9 +287,7 @@ describe('Session recording', () => {
beforeEach(() => {
start({
options: {
session_recording: {
report_recording_started: true,
},
session_recording: {},
},
decideResponseOverrides: {
isAuthenticated: false,
Expand Down Expand Up @@ -430,9 +424,7 @@ describe('Session recording', () => {
// and refresh the page
cy.reload()
cy.posthogInit({
session_recording: {
report_recording_started: true,
},
session_recording: {},
})
cy.wait('@decide')
cy.wait('@recorder')
Expand Down Expand Up @@ -600,9 +592,7 @@ describe('Session recording', () => {
beforeEach(() => {
start({
options: {
session_recording: {
report_recording_started: true,
},
session_recording: {},
},
decideResponseOverrides: {
isAuthenticated: false,
Expand Down
6 changes: 4 additions & 2 deletions src/extensions/replay/sessionrecording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,9 @@ export class SessionRecording {
}

logger.info(LOGGER_PREFIX + ' starting')
this._reportStarted(startReason || 'recording_initialized', () => this.status === 'active')
if (this.status === 'active') {
this._reportStarted(startReason || 'recording_initialized')
}
}

private isInteractiveEvent(event: eventWithTime) {
Expand Down Expand Up @@ -1131,7 +1133,7 @@ export class SessionRecording {
}

private _reportStarted(startReason: SessionStartReason, shouldReport: () => boolean = () => true) {
if (this.instance.config.session_recording.report_recording_started && shouldReport()) {
if (shouldReport()) {
this.instance.register_for_session({
$session_recording_start_reason: startReason,
})
Expand Down
6 changes: 0 additions & 6 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,6 @@ export interface SessionRecordingOptions {
Default is 5 minutes.
*/
session_idle_threshold_ms?: number
/*
Sends an event whenever a recording starts, with the reason the recording started.
Useful, for example, when using ingestion controls
to have a signal in batch exports to know which sessions have recordings
*/
report_recording_started?: boolean
}

export type SessionIdChangedCallback = (
Expand Down

0 comments on commit 042a7aa

Please sign in to comment.