From 64cde828db568f056db52fc36d6a28227beac9c1 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Wed, 13 Nov 2024 23:30:41 +0000 Subject: [PATCH] fix --- src/__tests__/extensions/replay/sessionrecording.test.ts | 1 + src/extensions/replay/sessionrecording.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/__tests__/extensions/replay/sessionrecording.test.ts b/src/__tests__/extensions/replay/sessionrecording.test.ts index 64d7bbc1f..e880247eb 100644 --- a/src/__tests__/extensions/replay/sessionrecording.test.ts +++ b/src/__tests__/extensions/replay/sessionrecording.test.ts @@ -1891,6 +1891,7 @@ describe('SessionRecording', () => { loadScriptMock.mockImplementation((_ph, _path, callback) => { callback() }) + sessionRecording = new SessionRecording(posthog) sessionRecording.afterDecideResponse(makeDecideResponse({ sessionRecording: { endpoint: '/s/' } })) sessionRecording.startIfEnabledOrStop() diff --git a/src/extensions/replay/sessionrecording.ts b/src/extensions/replay/sessionrecording.ts index 2990aa12f..4896abb1f 100644 --- a/src/extensions/replay/sessionrecording.ts +++ b/src/extensions/replay/sessionrecording.ts @@ -1348,7 +1348,9 @@ export class SessionRecording { this.instance.register_for_session({ $session_recording_start_reason: startReason, }) - this._tryAddCustomEvent(startReason, tagPayload) logger.info(LOGGER_PREFIX + ' ' + startReason.replace('_', ' '), tagPayload) + if (startReason !== 'recording_initialized') { + this._tryAddCustomEvent(startReason, tagPayload) + } } }