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: Hoist flush, close, and lastEventId into @sentry/core #8731

Merged
merged 7 commits into from
Aug 4, 2023

Conversation

lforst
Copy link
Member

@lforst lforst commented Aug 3, 2023

The current duplicated implementation of flush, close and lastEventId makes those functions hard to work with in "isomorphic" SDKs like Next.js and Sveltekit.

A simple example: We could make our wrapping methods in Next.js isomorphic, however, these functions make use of flush so we would need to import either from @sentry/browser or @sentry/node which goes a bit against the whole isomorphism.

This PR hoists these functions up into @sentry/core so that we can access them isomorphically.

There is one thing going on that's worth wasting one or two brain cells on, namely that we change the return types of flush and close from PromiseLike to Promise in the browser SDK, but that should be fine since Promise obviously implements PromiseLike.

On that note, because I mentioned "isomorphic" a lot, I decided to google it to check if it was actually a thing and it even has its own wikipedia article so we gucci: https://en.wikipedia.org/wiki/Isomorphic_JavaScript

@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2023

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 74.86 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 31.11 KB (0%)
@sentry/browser - Webpack (gzipped) 21.81 KB (0%)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 69.54 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 28.15 KB (+0.05% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 20.17 KB (+0.13% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 219.06 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 84.67 KB (+0.05% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 59.83 KB (+0.07% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 31.02 KB (+1.94% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 65.05 KB (-0.01% 🔽)
@sentry/react - Webpack (gzipped) 21.84 KB (0%)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 92.65 KB (+0.01% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 50.61 KB (-0.02% 🔽)

@lforst lforst marked this pull request as ready for review August 4, 2023 09:21
@lforst lforst merged commit b9a1c2b into develop Aug 4, 2023
78 checks passed
@lforst lforst deleted the lforst-hoist-shared-sdk-methods branch August 4, 2023 12:49
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.

None yet

2 participants