Skip to content

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented May 6, 2022

This PR fixes a bug which assigned the wrong Hub instance to a Transaction in the Transaction constructor. It removes the isInstanceOf check which incorrectly failed when passing a user-created Hub the constructor. Overall, the PR simplifies the hub initialization by deciding in the constructor if the passed Hub should be used. As a fallback, the Hub returned from getCurrentHub is used.

This fix was originally created by @lobsterkatie in 7.x...temp-5-5-fix-hub-in-transaction-constructor.

ref: https://getsentry.atlassian.net/browse/ISSUE-1402

- fixes wrong Hub being initialized when `isInstanceOf` fails incorrectly
- simplify `Transaction._hub` initialization
@github-actions
Copy link
Contributor

github-actions bot commented May 6, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 18.72 KB (-7.04% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 58.51 KB (-9.45% 🔽)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 17.53 KB (-7.04% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 52.69 KB (-9.11% 🔽)
@sentry/browser - Webpack (gzipped + minified) 19.2 KB (-17.38% 🔽)
@sentry/browser - Webpack (minified) 62.07 KB (-24.05% 🔽)
@sentry/react - Webpack (gzipped + minified) 19.22 KB (-17.43% 🔽)
@sentry/nextjs Client - Webpack (gzipped + minified) 42.88 KB (-10.78% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 24.49 KB (-6.09% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 23.07 KB (-5.78% 🔽)

Copy link
Contributor

@lforst lforst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me although I still wonder why that isInstanceOf call returns false.

@Lms24
Copy link
Member Author

Lms24 commented May 6, 2022

yes, me too. Katie and I are gonna take a look at it next Thursday. You're very welcome to join.

@Lms24 Lms24 merged commit c9e3602 into 7.x May 6, 2022
@Lms24 Lms24 deleted the lms-fix-tx-ctor branch May 6, 2022 13:32
@Lms24 Lms24 changed the title fix(tracing): Remove isInstanceOf check in Hub constructor fix(tracing): Remove isInstanceOf check in Transaction constructor May 6, 2022
@AbhiPrasad AbhiPrasad added this to the 7.0.0 milestone May 12, 2022
AbhiPrasad pushed a commit that referenced this pull request May 30, 2022
fix a bug which assigned the wrong Hub instance to a Transaction in the Transaction constructor. Remove the isInstanceOf check which incorrectly failed when passing a user-created Hub the constructor. Overall, simplify the hub initialization by deciding in the constructor if the passed Hub should be used. As a fallback, the Hub returned from getCurrentHub is used.

Co-authored by: @lobsterkatie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants