Skip to content

Commit 919f60b

Browse files
authored
doc: Add clarifying comment for hub on ACS (#11633)
Added a comment for #11630 (comment)!
1 parent 0d2c960 commit 919f60b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

packages/core/src/asyncContext/stackStrategy.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,13 @@ export class AsyncContextStack {
132132
*/
133133
function getAsyncContextStack(): AsyncContextStack {
134134
const registry = getMainCarrier();
135+
136+
// For now we continue to keep this as `hub` on the ACS,
137+
// as e.g. the Loader Script relies on this.
138+
// Eventually we may change this if/when we update the loader to not require this field anymore
139+
// Related, we also write to `hub` in {@link ./../sdk.ts registerClientOnGlobalHub}
135140
const sentry = getSentryCarrier(registry) as { hub?: AsyncContextStack };
136141

137-
// If there's no hub, or its an old API, assign a new one
138142
if (sentry.hub) {
139143
return sentry.hub;
140144
}

packages/core/src/sdk.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ export function setCurrentClient(client: Client): void {
4848
}
4949

5050
/**
51-
* Unfortunately, we still have to manually bind the client to the "hub" set on the global
51+
* Unfortunately, we still have to manually bind the client to the "hub" property set on the global
5252
* Sentry carrier object. This is because certain scripts (e.g. our loader script) obtain
5353
* the client via `window.__SENTRY__.hub.getClient()`.
5454
*
55-
* @see {@link hub.ts getGlobalHub}
55+
* @see {@link ./asyncContext/stackStrategy.ts getAsyncContextStack}
5656
*/
5757
function registerClientOnGlobalHub(client: Client): void {
5858
const sentryGlobal = getSentryCarrier(getMainCarrier()) as { hub?: AsyncContextStack };

0 commit comments

Comments
 (0)