11/* eslint-disable max-lines */ // TODO: We might want to split this file up
22import { addGlobalEventProcessor , captureException , getCurrentHub } from '@sentry/core' ;
3- import type { Breadcrumb , ReplayRecordingMode , ReplayRecordingData } from '@sentry/types' ;
3+ import type { Breadcrumb , ReplayRecordingData , ReplayRecordingMode } from '@sentry/types' ;
44import type { RateLimits } from '@sentry/utils' ;
55import { addInstrumentationHandler , disabledUntil , logger } from '@sentry/utils' ;
66import { EventType , record } from 'rrweb' ;
@@ -20,6 +20,7 @@ import type {
2020 AddUpdateCallback ,
2121 AllPerformanceEntry ,
2222 EventBuffer ,
23+ FlushOptions ,
2324 InstrumentationTypeBreadcrumb ,
2425 InternalEventContext ,
2526 PopEventContext ,
@@ -28,7 +29,6 @@ import type {
2829 ReplayContainer as ReplayContainerInterface ,
2930 ReplayPluginOptions ,
3031 Session ,
31- FlushOptions ,
3232} from './types' ;
3333import { addEvent } from './util/addEvent' ;
3434import { addMemoryEntry } from './util/addMemoryEntry' ;
@@ -152,7 +152,7 @@ export class ReplayContainer implements ReplayContainerInterface {
152152 * Creates or loads a session, attaches listeners to varying events (DOM,
153153 * _performanceObserver, Recording, Sentry SDK, etc)
154154 */
155- public async start ( ) : Promise < void > {
155+ public start ( ) : void {
156156 this . _setInitialState ( ) ;
157157
158158 this . _loadSession ( { expiry : SESSION_IDLE_DURATION } ) ;
@@ -625,7 +625,7 @@ export class ReplayContainer implements ReplayContainerInterface {
625625 // Send replay when the page/tab becomes hidden. There is no reason to send
626626 // replay if it becomes visible, since no actions we care about were done
627627 // while it was hidden
628- this . _conditionalFlush ( { finishImmediate : true } ) ;
628+ this . _conditionalFlush ( { finishImmediate : true } ) ;
629629 }
630630
631631 /**
@@ -818,7 +818,7 @@ export class ReplayContainer implements ReplayContainerInterface {
818818 promises . push ( this . _addPerformanceEntries ( ) ) ;
819819
820820 // Do not continue if there are no pending events in buffer
821- if ( ! this . eventBuffer ? .pendingLength ) {
821+ if ( ! this . eventBuffer || ! this . eventBuffer . pendingLength ) {
822822 return ;
823823 }
824824
@@ -857,7 +857,7 @@ export class ReplayContainer implements ReplayContainerInterface {
857857 recordingData = await this . eventBuffer . finish ( ) ;
858858 }
859859
860- const sendReplayPromise = sendReplay ( {
860+ await sendReplay ( {
861861 replayId,
862862 recordingData,
863863 segmentId,
@@ -867,10 +867,6 @@ export class ReplayContainer implements ReplayContainerInterface {
867867 options : this . getOptions ( ) ,
868868 timestamp : new Date ( ) . getTime ( ) ,
869869 } ) ;
870-
871- await sendReplayPromise ;
872-
873- return ;
874870 } catch ( err ) {
875871 this . _handleException ( err ) ;
876872
0 commit comments