File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
packages/browser/src/plugins/ajs-destination Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @segment/analytics-next ' : patch
3+ ---
4+
5+ fix: fixes buffering for legacy destinations
Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ export class LegacyDestination implements InternalPluginWithAddMiddleware {
192192 return (
193193 // page events can't be buffered because of destinations that automatically add page views
194194 ctx . event . type !== 'page' &&
195- ( isOffline ( ) || this . _ready === false || this . _initialized === false )
195+ ( isOffline ( ) || this . _ready !== true || this . _initialized !== true )
196196 )
197197 }
198198
@@ -313,6 +313,11 @@ export class LegacyDestination implements InternalPluginWithAddMiddleware {
313313
314314 // eslint-disable-next-line @typescript-eslint/no-misused-promises
315315 setTimeout ( async ( ) => {
316+ if ( isOffline ( ) || this . _ready !== true || this . _initialized !== true ) {
317+ this . scheduleFlush ( )
318+ return
319+ }
320+
316321 this . flushing = true
317322 this . buffer = await flushQueue ( this , this . buffer )
318323 this . flushing = false
You can’t perform that action at this time.
0 commit comments