Skip to content

feat(core): Add setClient() and getClient() to Scope #10055

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

Merged
merged 2 commits into from
Jan 4, 2024

Conversation

lforst
Copy link
Contributor

@lforst lforst commented Jan 4, 2024

Adds a getter and setter for client objects to the Scope to align with the new Scope API. We also adjust the logic in the Hub constructor to correctly set the client on newly instantiated scope objects residing on the hub.

Copy link
Contributor

github-actions bot commented Jan 4, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 76.1 KB (+0.05% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 67.49 KB (+0.06% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 61.1 KB (+0.06% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 32.08 KB (+0.12% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 30.49 KB (+0.1% 🔺)
@sentry/browser - Webpack (gzipped) 22.21 KB (+0.17% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 73.53 KB (+0.07% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 65.2 KB (+0.07% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 31.37 KB (+0.12% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 23.29 KB (+0.21% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 204.35 KB (+0.06% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 94.24 KB (+0.13% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 69.09 KB (+0.17% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 34.33 KB (+0.1% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 67.91 KB (+0.06% 🔺)
@sentry/react - Webpack (gzipped) 22.23 KB (+0.18% 🔺)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 84.53 KB (+0.06% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 49.14 KB (+0.09% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 16.73 KB (+0.23% 🔺)

Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

I think this is fine on it's own, the next thing we need to do is update getClient() to actually look clients up on the scopes, and fall back on the hub only if none exists there.

@lforst
Copy link
Contributor Author

lforst commented Jan 4, 2024

@mydea Right. Although I believe this would be dangerous to do right now... I think for all v7 releases we're better off still calling getCurrentHub().getClient() under the hood. Or am I missing something that we actually need to do?

@mydea
Copy link
Member

mydea commented Jan 4, 2024

Yeah it's probably right. We can change the semantic of this in V8, and keep it as-is for now.

@lforst lforst merged commit 59ffba3 into develop Jan 4, 2024
@lforst lforst deleted the lforst-client-on-scope branch January 4, 2024 14:47
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.

2 participants