Skip to content

Commit 99b2852

Browse files
Ref: Use main carrier on useEncodePolyfill (#4731)
* bump SDKs * bump SDKs * fix build * fix tests * fix tests * fix lint errors * test ts 5.0 * rollback * fix merge conflict with yarn * fix new lint issue * sync yarn.lock with V7 branch and install new packages * ensure we are using the JS version from the default node resolution * update changelog with javascript version bump * fix check type (#4587) * add major changes to the SDK * fix lint * review check: fix changelog PR number / Fix wrapper incorrect null check / removed comment from rnerror handler / removed comment from span / fix test from userInteraction * fix incorrect cli version * fix lint * remove shutdowntimeout from android / use newer wizard version * rollback feedback test change, rollback jest version, fix safe test * return shutdowntimeout * explain tracing sample rate * fix tracing extension test * lint fix * update changelog * fix yarn lock merge/ fix ts-jest version no longer exists / fix core version on samples and e2e * fix lint on addTimeToInitialDisplay * fix issue with UIManager test * use main carrier * fix yarn lint * moved major changes to the correct spot
1 parent a852e28 commit 99b2852

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/core/src/js/transports/encodePolyfill.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
import { SDK_VERSION } from '@sentry/core';
1+
import { getMainCarrier, SDK_VERSION } from '@sentry/core';
22

3-
import { RN_GLOBAL_OBJ } from '../utils/worldwide';
3+
import type { RN_GLOBAL_OBJ } from '../utils/worldwide';
44
import { utf8ToBytes } from '../vendor';
55

66
export const useEncodePolyfill = (): void => {
7-
if (!RN_GLOBAL_OBJ.__SENTRY__) {
8-
(RN_GLOBAL_OBJ.__SENTRY__ as Partial<(typeof RN_GLOBAL_OBJ)['__SENTRY__']>) = {};
7+
const globalCarriers = getMainCarrier().__SENTRY__;
8+
9+
if (!globalCarriers) {
10+
(globalCarriers as Partial<(typeof RN_GLOBAL_OBJ)['__SENTRY__']>) = {};
911
}
1012

11-
RN_GLOBAL_OBJ.__SENTRY__[SDK_VERSION].encodePolyfill = encodePolyfill;
13+
globalCarriers[SDK_VERSION].encodePolyfill = encodePolyfill;
1214
};
1315

1416
export const encodePolyfill = (text: string): Uint8Array => {

0 commit comments

Comments
 (0)