Skip to content

Commit 1b6ed3e

Browse files
committed
Switch back to WINDOW
1 parent fb42933 commit 1b6ed3e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/react/src/reactrouterv6-compat-utils.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
browserTracingIntegration,
77
startBrowserTracingNavigationSpan,
88
startBrowserTracingPageLoadSpan,
9+
WINDOW,
910
} from '@sentry/browser';
1011
import type { Client, Integration, Span, TransactionSource } from '@sentry/core';
1112
import {
@@ -15,7 +16,6 @@ import {
1516
getClient,
1617
getCurrentScope,
1718
getRootSpan,
18-
GLOBAL_OBJ,
1919
SEMANTIC_ATTRIBUTE_SENTRY_OP,
2020
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
2121
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
@@ -53,12 +53,12 @@ let _enableAsyncRouteHandlers: boolean = false;
5353
const CLIENTS_WITH_INSTRUMENT_NAVIGATION = new WeakSet<Client>();
5454

5555
/**
56-
* Gets the current location from the global object (window in browser environments).
57-
* Returns undefined if global location is not available.
56+
* Gets the current location from the window object in browser environments.
57+
* Returns undefined if window is not available.
5858
*/
5959
function getGlobalLocation(): Location | undefined {
60-
if (typeof GLOBAL_OBJ !== 'undefined') {
61-
const globalLocation = (GLOBAL_OBJ as typeof GLOBAL_OBJ & Window).location;
60+
if (typeof WINDOW !== 'undefined') {
61+
const globalLocation = WINDOW.location;
6262
if (globalLocation) {
6363
return { pathname: globalLocation.pathname };
6464
}
@@ -67,12 +67,12 @@ function getGlobalLocation(): Location | undefined {
6767
}
6868

6969
/**
70-
* Gets the pathname from the global object (window in browser environments).
71-
* Returns undefined if global location is not available.
70+
* Gets the pathname from the window object in browser environments.
71+
* Returns undefined if window is not available.
7272
*/
7373
function getGlobalPathname(): string | undefined {
74-
if (typeof GLOBAL_OBJ !== 'undefined') {
75-
return (GLOBAL_OBJ as typeof GLOBAL_OBJ & Window).location?.pathname;
74+
if (typeof WINDOW !== 'undefined') {
75+
return WINDOW.location?.pathname;
7676
}
7777
return undefined;
7878
}

0 commit comments

Comments
 (0)