Skip to content
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(utils): Introduce getEnvelopeType helper #4751

Merged
merged 5 commits into from
Mar 23, 2022
Merged

Conversation

AbhiPrasad
Copy link
Member

Simplify new transport send by grabbing the envelope category from the
envelope instead of passing it in explicitly.

Simplify new transport send by grabbing the envelope category from the
envelope instead of passing it in explicitly.
@AbhiPrasad AbhiPrasad requested review from a team, lforst and lobsterkatie and removed request for a team March 22, 2022 13:33
@github-actions
Copy link
Contributor

github-actions bot commented Mar 22, 2022

size-limit report

Path Base Size (a929462) Current Size Change
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.49 KB 19.49 KB -0.02% 🔽
@sentry/browser - ES5 CDN Bundle (minified) 62.17 KB 62.17 KB 0%
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.12 KB 18.11 KB -0.02% 🔽
@sentry/browser - ES6 CDN Bundle (minified) 55.5 KB 55.5 KB 0%
@sentry/browser - Webpack (gzipped + minified) 22.6 KB 22.6 KB 0%
@sentry/browser - Webpack (minified) 79.21 KB 79.21 KB 0%
@sentry/react - Webpack (gzipped + minified) 22.63 KB 22.63 KB 0%
@sentry/nextjs Client - Webpack (gzipped + minified) 47.6 KB 47.6 KB 0%
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 25.36 KB 25.36 KB -0.01% 🔽
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 23.72 KB 23.72 KB -0.01% 🔽

@@ -104,7 +106,8 @@ export function createTransport(

const flush = (timeout?: number): PromiseLike<boolean> => buffer.drain(timeout);

function send(envelope: Envelope, category: TransportCategory): PromiseLike<TransportResponse> {
function send(envelope: Envelope): PromiseLike<TransportResponse> {
const category = getEnvelopeType(envelope) as TransportCategory;
Copy link
Member

@lforst lforst Mar 22, 2022

Choose a reason for hiding this comment

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

Naive question because I'm not too familiar with envelopes yet: Would it make sense to change the return type of getEnvelopeType to be more strict instead of casting here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to make this more clear!

packages/utils/src/envelope.ts Show resolved Hide resolved
@AbhiPrasad AbhiPrasad enabled auto-merge (squash) March 23, 2022 12:44
@AbhiPrasad AbhiPrasad merged commit 5f6335d into master Mar 23, 2022
@AbhiPrasad AbhiPrasad deleted the abhi-get-env-type branch March 23, 2022 13:11
@AbhiPrasad AbhiPrasad added this to the Pre 7.0.0 Work milestone Mar 23, 2022
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