-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
ref(core)!: Remove backwards compatible SentryCarrier type #14697
Conversation
size-limit report 📦
|
import { SDK_VERSION } from './version'; | ||
|
||
interface SentryCarrier { |
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.
this type was basically duplicated here - this comes from the days of core vs utils separation, I believe 😬
export function getGlobalSingleton<T>(name: keyof SentryCarrier, creator: () => T, obj?: unknown): T { | ||
const gbl = (obj || GLOBAL_OBJ) as InternalGlobal; | ||
const __SENTRY__ = (gbl.__SENTRY__ = gbl.__SENTRY__ || {}); | ||
export function getGlobalSingleton<Prop extends keyof SentryCarrier>( |
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.
Made this more type safe and actually inferring types correctly for passed in stuff!
95a71c1
to
30d32a5
Compare
❌ 12 Tests Failed:
View the top 3 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
30d32a5
to
753d1f0
Compare
753d1f0
to
5860651
Compare
I do not really think this is breaking or has any impact on any user code, but to be on the safe side, we can remove this in v9.
d37b8c9
to
6cbe609
Compare
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 cleanup, thanks!
const __SENTRY__ = (obj.__SENTRY__ = obj.__SENTRY__ || {}); | ||
const carrier = (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {}); |
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.
l: we could call getSentryCarrier(obj)
here to save some bytes, no?
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.
actually no 😬 I had that first but it broke loader tests. This is why I added the comment below - if we'd call that, it would already set the version, which would lead to stuff thinking the SDK is set up, when it isn't. We store e.g. the default global/isolation scope on there even before the SDK is setup, so we need to ensure the version
is not set here yet!
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.
(on the plus side, the loader tests are good! xD)
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.
ah sorry, I should have read the comment 🤦 thanks!
I do not really think this is breaking or has any impact on any user code, but to be on the safe side, we can remove this in v9.
The one actual breaking thing is to also move the
encodePolyfill
/decodePolyfill
code to the versioned carrier - this was before still on the global, making this a bit harder than necessary. In v9, this will have to be set on the versioned carrier the same as other things - cc @krystofwoldrich