Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(browser): Wait for document 'complete' state before terminating pageload transaction #10685

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio

if (isPageloadTransaction && WINDOW.document) {
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();
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/tracing-internal/src/browser/browsertracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
Loading