Skip to content

Commit 9fc8151

Browse files
fix(client): use _setupIntegrations to extend both init and public setupIntegrations (#3882)
1 parent f2f3399 commit 9fc8151

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
### Fixes
1212

1313
- Add more expressive debug logs to Native Frames Integration ([#3880](https://github.com/getsentry/sentry-react-native/pull/3880))
14+
- Add missing tracing integrations when using `client.init()` ([#3882](https://github.com/getsentry/sentry-react-native/pull/3882))
1415

1516
### Dependencies
1617

src/js/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ export class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {
109109
/**
110110
* Sets up the integrations
111111
*/
112-
public setupIntegrations(): void {
113-
super.setupIntegrations();
112+
protected _setupIntegrations(): void {
113+
super._setupIntegrations();
114114
const tracing = this.getIntegration(ReactNativeTracing);
115115
const routingName = tracing?.options.routingInstrumentation?.name;
116116
if (routingName) {

test/client.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,22 @@ describe('Tests ReactNativeClient', () => {
667667
expect(client.getIntegrationById('ReactNativeUserInteractionTracing')).toBeTruthy();
668668
});
669669

670+
test('register user interactions tracing - init()', () => {
671+
const client = new ReactNativeClient(
672+
mockedOptions({
673+
dsn: EXAMPLE_DSN,
674+
integrations: [
675+
new ReactNativeTracing({
676+
enableUserInteractionTracing: true,
677+
}),
678+
],
679+
}),
680+
);
681+
client.init();
682+
683+
expect(client.getIntegrationById('ReactNativeUserInteractionTracing')).toBeTruthy();
684+
});
685+
670686
test('do not register user interactions tracing', () => {
671687
const client = new ReactNativeClient(
672688
mockedOptions({
@@ -682,6 +698,22 @@ describe('Tests ReactNativeClient', () => {
682698

683699
expect(client.getIntegrationById('ReactNativeUserInteractionTracing')).toBeUndefined();
684700
});
701+
702+
test('do not register user interactions tracing - init()', () => {
703+
const client = new ReactNativeClient(
704+
mockedOptions({
705+
dsn: EXAMPLE_DSN,
706+
integrations: [
707+
new ReactNativeTracing({
708+
enableUserInteractionTracing: false,
709+
}),
710+
],
711+
}),
712+
);
713+
client.init();
714+
715+
expect(client.getIntegrationById('ReactNativeUserInteractionTracing')).toBeUndefined();
716+
});
685717
});
686718
});
687719

0 commit comments

Comments
 (0)