-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref(core): Rename Hub
to AsyncContextStack
& remove unneeded methods
#11630
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
Conversation
Should save some bundle size...!
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; | ||
} | ||
|
||
sentry.hub = new AsyncContextStack(getDefaultCurrentScope(), getDefaultIsolationScope()); | ||
return sentry.hub; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we stop referencing it by .hub
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sadly not because some stuff like the loader depends on this 😬 @Lms24 learned this the hard way I believe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's also the reason that this still has a getClient()
method!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, if we remove/rename .hub
our loader tests will fail because our loader script accesses __SENTRY__.hub.getClient()
to check if the SDK was initialized before the loader otherwise initializes the SDK (at least that's what I think it does; the script certainly makes the access). So I guess we can only remove this once we update the loader script 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can still do this when v8 becomes stable I guess, but it's possibly not worth it too as it may break stuff weirdly I guess that depends on internals 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we leave a comment about this somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #11633 👍
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, great size reduction!
Took the liberty to link this in #11482 because afaict this closes the issue 🎉
Added a comment for #11630 (comment)!
Now that #11630 was merged in, we can remove `setupGlobalHub`.
Should save some bundle size...! I also moved stuff around a bit so we don't have so much somewhat unrelated stuff packed into the former
hub.ts
file - needed some work to avoid circular dependencies, but I think it's fine now.I left the stuff we actually need in, and renamed it for clarity so this is not confusing anymore.
closes #11482