diff --git a/MIGRATION.md b/MIGRATION.md index 261ee10d0bf6..ec40640bad24 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,5 +1,13 @@ # Upgrading from 7.x to 8.x +## Updated Logic for Browser Pageload Transactions + +The v8 release includes a behavioural change for pageload transactions. Transactions that track browser pageloads will +now at least wait for the +[`complete` document ready state](https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState) before being +finished. Note that this change may affect span duration in Sentry - keep this in mind if you have alerts set up for +this metric. + ## Updated behaviour of `tracePropagationTargets` in the browser (HTTP tracing headers & CORS) We updated the behaviour of the SDKs when no `tracePropagationTargets` option was defined. As a reminder, you can diff --git a/packages/tracing-internal/src/browser/browserTracingIntegration.ts b/packages/tracing-internal/src/browser/browserTracingIntegration.ts index 95dee0c42f5e..aa7a1ce70766 100644 --- a/packages/tracing-internal/src/browser/browserTracingIntegration.ts +++ b/packages/tracing-internal/src/browser/browserTracingIntegration.ts @@ -268,12 +268,12 @@ export const browserTracingIntegration = ((_options: Partial { - if (['interactive', 'complete'].includes(WINDOW.document.readyState)) { + if (WINDOW.document.readyState === 'complete') { idleTransaction.sendAutoFinishSignal(); } }); - if (['interactive', 'complete'].includes(WINDOW.document.readyState)) { + if (WINDOW.document.readyState === 'complete') { idleTransaction.sendAutoFinishSignal(); } } diff --git a/packages/tracing-internal/src/browser/browsertracing.ts b/packages/tracing-internal/src/browser/browsertracing.ts index 393cd7c69016..2330d42dcfd5 100644 --- a/packages/tracing-internal/src/browser/browsertracing.ts +++ b/packages/tracing-internal/src/browser/browsertracing.ts @@ -363,12 +363,12 @@ export class BrowserTracing implements Integration { if (isPageloadTransaction) { WINDOW.document.addEventListener('readystatechange', () => { - if (['interactive', 'complete'].includes(WINDOW.document.readyState)) { + if (WINDOW.document.readyState === 'complete') { idleTransaction.sendAutoFinishSignal(); } }); - if (['interactive', 'complete'].includes(WINDOW.document.readyState)) { + if (WINDOW.document.readyState === 'complete') { idleTransaction.sendAutoFinishSignal(); } }