From b30aae83099b16cbd74efa2833e48f6859e2a501 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Thu, 31 Oct 2024 12:38:56 -0400 Subject: [PATCH] revert some changes --- packages/replay-internal/src/util/addEvent.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/replay-internal/src/util/addEvent.ts b/packages/replay-internal/src/util/addEvent.ts index c20390e76c2e..d0e0593297e1 100644 --- a/packages/replay-internal/src/util/addEvent.ts +++ b/packages/replay-internal/src/util/addEvent.ts @@ -54,9 +54,7 @@ async function _addEvent( event: RecordingEvent, isCheckout?: boolean, ): Promise { - const { eventBuffer } = replay; - - if (!eventBuffer || (eventBuffer.waitForCheckout && !isCheckout)) { + if (!replay.eventBuffer || (replay.eventBuffer.waitForCheckout && !isCheckout)) { return null; } @@ -64,12 +62,12 @@ async function _addEvent( try { if (isCheckout && isBufferMode) { - eventBuffer.clear(); + replay.eventBuffer.clear(); } if (isCheckout) { - eventBuffer.hasCheckout = true; - eventBuffer.waitForCheckout = false; + replay.eventBuffer.hasCheckout = true; + replay.eventBuffer.waitForCheckout = false; } const replayOptions = replay.getOptions(); @@ -80,15 +78,15 @@ async function _addEvent( return; } - return await eventBuffer.addEvent(eventAfterPossibleCallback); + return await replay.eventBuffer.addEvent(eventAfterPossibleCallback); } catch (error) { const isExceeded = error && error instanceof EventBufferSizeExceededError; const reason = isExceeded ? 'addEventSizeExceeded' : 'addEvent'; if (isExceeded && isBufferMode) { // Clear buffer and wait for next checkout - eventBuffer.clear(); - eventBuffer.waitForCheckout = true; + replay.eventBuffer.clear(); + replay.eventBuffer.waitForCheckout = true; return null; }