Skip to content
Merged
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
6 changes: 5 additions & 1 deletion packages/core/src/asyncContext/stackStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,13 @@ export class AsyncContextStack {
*/
function getAsyncContextStack(): AsyncContextStack {
const registry = getMainCarrier();

// For now we continue to keep this as `hub` on the ACS,
// as e.g. the Loader Script relies on this.
// Eventually we may change this if/when we update the loader to not require this field anymore
// Related, we also write to `hub` in {@link ./../sdk.ts registerClientOnGlobalHub}
const sentry = getSentryCarrier(registry) as { hub?: AsyncContextStack };

// If there's no hub, or its an old API, assign a new one
if (sentry.hub) {
return sentry.hub;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export function setCurrentClient(client: Client): void {
}

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