Repository navigation
Conversation
Contributor
size-limit report 📦
|
isOlderThan to AsyncContextStackisOlderThan on __SENTRY__.hub
Lms24
marked this pull request as ready for review
May 22, 2024 13:12
isOlderThan on __SENTRY__.hubgetCurrentHubShim when accessing __SENTRY__.hub
Lms24
force-pushed
the
lms/fix-browser-carrier-hub-isOlderThan
branch
from
May 22, 2024 13:20
a9f6e83 to
9904d28
Compare
Lms24
force-pushed
the
lms/fix-browser-carrier-hub-isOlderThan
branch
from
May 22, 2024 14:17
c84413e to
f3ddaac
Compare
Lms24
commented
May 22, 2024
Comment on lines
+25
to
+28
| export function getCurrentHubShim(): Hub & { | ||
| getStackTop: () => { client: Client | undefined; scope: Scope }; | ||
| isOlderThan: () => boolean; | ||
| } { |
Member
Author
There was a problem hiding this comment.
Just noticed: We actually export this publicly from @sentry/core (not sure why we did this at all). Do we care that we widen the return type here?
Lms24
commented
May 22, 2024
| // (e.g. our loader script) accessing properties on `window.__SENTRY__.hub`. | ||
| // This will just call the `getCurrentHubShim` function, as if users would interact with `getCurrentHub`. | ||
| // eslint-disable-next-line deprecation/deprecation | ||
| Object.defineProperty(sentry, 'hub', { get: () => getCurrentHubShim(), enumerable: true }); |
Member
Author
There was a problem hiding this comment.
Second oof: Referencing getCurrentHubShim here actually increases bundle size by +1% because previously, getCurrentHub(Shim) was completely optional :(
Member
Author
|
Closing this because of the bundle size hit. We thought of another solution 🙃 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #12151
fixes getsentry/sentry-javascript-bundler-plugins#533
This PR makes a change to set our
AsyncStackStrategyonto__SENTRY__.stackinstead of__SENTRY__.hub. Instead, we now set thegetCurrentHubShimonto.hub. The shim now also has the oldisOlderThanandgetStackTop.