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

feat(utils): Allow text encoder/decoder polyfill from global __SENTRY__ #11283

Merged
merged 5 commits into from Mar 26, 2024

Conversation

krystofwoldrich
Copy link
Member

The TextEncoder option was removed in #10701 because all of the newly supported platforms support TextEncoder/Decoder.

Sadly that's not true for React Native, yet. TextEncoder will be included in the next release of RN with Hermes. See the PR facebook/hermes@3863a36#diff-4bf4a4ab271f254baf2097be87be98333ec69eb2d41e074b81147656c33145eb

We can not drop support of all the previous RN versions in the RN SDK v6 (the next major).

To avoid passing the encoder option around the SDK, I propose adding polyfill properties to the global SENTRY object which RN can use.

@krystofwoldrich krystofwoldrich requested review from timfish, a team, Lms24, AbhiPrasad and mydea and removed request for a team March 26, 2024 10:34
Copy link
Contributor

github-actions bot commented Mar 26, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) 80.55 KB (added)
@sentry/browser (incl. Tracing, Replay) 71.89 KB (added)
@sentry/browser (incl. Tracing, Replay with Canvas) 75.7 KB (added)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 65.44 KB (added)
@sentry/browser (incl. Tracing) 36.71 KB (added)
@sentry/browser (incl. browserTracingIntegration) 36.71 KB (added)
@sentry/browser (incl. feedbackIntegration) 31.35 KB (added)
@sentry/browser (incl. feedbackModalIntegration) 31.46 KB (added)
@sentry/browser (incl. feedbackScreenshotIntegration) 31.47 KB (added)
@sentry/browser (incl. sendFeedback) 27.42 KB (added)
@sentry/browser 22.58 KB (added)
CDN Bundle (incl. Tracing, Replay, Feedback) 74.9 KB (added)
CDN Bundle (incl. Tracing, Replay) 69.73 KB (added)
CDN Bundle (incl. Tracing) 36.3 KB (added)
CDN Bundle 23.94 KB (added)
CDN Bundle (incl. Tracing, Replay) - uncompressed 219.01 KB (added)
CDN Bundle (incl. Tracing) - uncompressed 109.57 KB (added)
CDN Bundle - uncompressed 70.92 KB (added)
@sentry/react (incl. Tracing, Replay) 71.87 KB (added)
@sentry/react 22.61 KB (added)

Copy link
Collaborator

@timfish timfish 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!

Sorry, I deleted these not knowing it would impact downstream. To be fair, I think this is a neater solution than before where we had to pass them around as options and then arguments.

@@ -57,6 +57,8 @@ export interface InternalGlobal {
defaultCurrentScope: Scope | undefined;
defaultIsolationScope: Scope | undefined;
globalMetricsAggregators: WeakMap<Client, MetricsAggregator> | undefined;
encodePolyfill?: (input: string) => Uint8Array;
decodePolyfill?: (input: Uint8Array) => string;
Copy link
Member

Choose a reason for hiding this comment

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

Let's leave a comment about what these should be used for!

@krystofwoldrich krystofwoldrich enabled auto-merge (squash) March 26, 2024 14:01
@krystofwoldrich krystofwoldrich merged commit 4e4f1da into develop Mar 26, 2024
93 checks passed
@krystofwoldrich krystofwoldrich deleted the kw-return-text-encoder-overwrite branch March 26, 2024 14:12
cadesalaberry pushed a commit to cadesalaberry/sentry-javascript that referenced this pull request Apr 19, 2024
…__ (getsentry#11283)

The TextEncoder option was removed in
getsentry#10701 because all of
the newly supported platforms support TextEncoder/Decoder.

Sadly that's not true for React Native, yet. TextEncoder will be
included in the next release of RN with Hermes. See the PR
facebook/hermes@3863a36#diff-4bf4a4ab271f254baf2097be87be98333ec69eb2d41e074b81147656c33145eb

We can not drop support of all the previous RN versions in the RN SDK v6
(the next major).

To avoid passing the encoder option around the SDK, I propose adding
polyfill properties to the global __SENTRY__ object which RN can use.
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

3 participants