Skip to content

Commit 055398f

Browse files
committed
rm registerClientOnGlobalHub
1 parent b74ee3f commit 055398f

File tree

3 files changed

+2
-22
lines changed

3 files changed

+2
-22
lines changed

dev-packages/browser-integration-tests/fixtures/loader.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,8 @@
101101
// carrier. This needs still needs to be added to the actual loader script before we
102102
// release the loader for v8!
103103
var v = e && e.version && e[e.version];
104-
var c = v && v.stack && v.stack.getClient();
105104

106-
return !(void 0 === e || !e.hub || !e.hub.getClient()) || !!c;
105+
return !(void 0 === e || !e.hub || !e.hub.getClient()) || !!v;
107106
}
108107
(n[i] = n[i] || {}),
109108
(n[i].onLoad = function (n) {

packages/core/src/sdk.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { Client, ClientOptions } from '@sentry/types';
22
import { consoleSandbox, logger } from '@sentry/utils';
33
import { getCurrentScope } from './currentScopes';
44

5-
import { getMainCarrier, getSentryCarrier } from './carrier';
65
import { DEBUG_BUILD } from './debug-build';
76

87
/** A class object that can instantiate Client objects. */
@@ -43,21 +42,4 @@ export function initAndBind<F extends Client, O extends ClientOptions>(
4342
*/
4443
export function setCurrentClient(client: Client): void {
4544
getCurrentScope().setClient(client);
46-
registerClientOnGlobalHub(client);
47-
}
48-
49-
/**
50-
* Unfortunately, we still have to manually bind the client to the "stack" property set on the global
51-
* Sentry carrier object. This is because certain scripts (e.g. our loader script) obtain
52-
* the client via `window.__SENTRY__[version].stack.getClient()`.
53-
*
54-
* @see {@link ./asyncContext/stackStrategy.ts getAsyncContextStack}
55-
*/
56-
function registerClientOnGlobalHub(client: Client): void {
57-
try {
58-
// @ts-expect-error - purposefully not guarding the call here but try/catching for bundle size efficiency
59-
getSentryCarrier(getMainCarrier()).stack.getStackTop().client = client;
60-
} catch {
61-
// ignore errors here
62-
}
6345
}

packages/utils/src/worldwide.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,5 @@ export function getGlobalSingleton<T>(name: keyof SentryCarrier, creator: () =>
103103
const gbl = (obj || GLOBAL_OBJ) as InternalGlobal;
104104
const __SENTRY__ = (gbl.__SENTRY__ = gbl.__SENTRY__ || {});
105105
const versionedCarrier = (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});
106-
const singleton = versionedCarrier[name] || (versionedCarrier[name] = creator());
107-
return singleton;
106+
return versionedCarrier[name] || (versionedCarrier[name] = creator());
108107
}

0 commit comments

Comments
 (0)