From 6257ada53f5da5da2c0d651f2bd4b5974f0bf4b3 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Wed, 30 Jul 2025 16:16:12 -0400 Subject: [PATCH] fix(replay/v9): Call `sendBufferedReplayOrFlush` when opening/sending feedback I noticed that our replays w/ feedbacks have gaps while the user is entering in their feedback. This is because we call `replay.flush` (not to be confused w/ the public replay integration integration which also has a flush) which only flushes the buffer and continues to buffer. What we want is to call `sendBufferedReplayOrFlush` which will convert the buffered replay into a session replay (after flushing) in order to continue recording. --- packages/replay-internal/src/util/addGlobalListeners.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/replay-internal/src/util/addGlobalListeners.ts b/packages/replay-internal/src/util/addGlobalListeners.ts index cd5c141d0160..0f1ddba0a2a2 100644 --- a/packages/replay-internal/src/util/addGlobalListeners.ts +++ b/packages/replay-internal/src/util/addGlobalListeners.ts @@ -62,14 +62,14 @@ export function addGlobalListeners(replay: ReplayContainer): void { if (options?.includeReplay && replay.isEnabled() && replayId && feedbackEvent.contexts?.feedback) { // In case the feedback is sent via API and not through our widget, we want to flush replay if (feedbackEvent.contexts.feedback.source === 'api') { - await replay.flush(); + await replay.sendBufferedReplayOrFlush(); } feedbackEvent.contexts.feedback.replay_id = replayId; } }); client.on('openFeedbackWidget', async () => { - await replay.flush(); + await replay.sendBufferedReplayOrFlush(); }); } }