From 3fcd6d88b3266be69ea44d37c87a3f1fdb876a3c Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 20 Sep 2021 13:44:11 -0400 Subject: [PATCH] fix(browser): Check for document when sending outcomes (#3993) --- packages/browser/src/transports/base.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/browser/src/transports/base.ts b/packages/browser/src/transports/base.ts index 3390c46259a4..a4a8f054524e 100644 --- a/packages/browser/src/transports/base.ts +++ b/packages/browser/src/transports/base.ts @@ -42,7 +42,7 @@ export abstract class BaseTransport implements Transport { // eslint-disable-next-line deprecation/deprecation this.url = this._api.getStoreEndpointWithUrlEncodedAuth(); - if (this.options.sendClientReports) { + if (this.options.sendClientReports && document) { document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'hidden') { this._flushOutcomes();