Skip to content

Commit 22e86ad

Browse files
Merge 0487651 into a5ddcda
2 parents a5ddcda + 0487651 commit 22e86ad

3 files changed

Lines changed: 37 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Version 7 of the SDK is compatible with Sentry self-hosted versions 24.4.2 or hi
1616

1717
### Dependencies
1818

19-
- Bump Bundler Plugins from v3.2.2 to v3.2.4 ([#4693](https://github.com/getsentry/sentry-react-native/pull/4693), [#4707](https://github.com/getsentry/sentry-react-native/pull/4707))
19+
- Bump Bundler Plugins from v3.2.2 to v3.2.4 ([#4693](https://github.com/getsentry/sentry-react-native/pull/4693), [#4707](https://github.com/getsentry/sentry-react-native/pull/4707), [#4732](https://github.com/getsentry/sentry-react-native/pull/4732))
2020
- [changelog](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/main/CHANGELOG.md#324)
2121
- [diff](https://github.com/getsentry/sentry-javascript-bundler-plugins/compare/3.2.2...3.2.4)
2222
- Bump CLI from v2.42.4 to v2.43.0 ([#4692](https://github.com/getsentry/sentry-react-native/pull/4692))
@@ -54,7 +54,7 @@ Version 7 of the SDK is compatible with Sentry self-hosted versions 24.4.2 or hi
5454
## Other Changes
5555

5656
- Fork `scope` if custom scope is passed to `startSpanManual` or `startSpan`
57-
57+
- On React Native Web, `browserSessionIntegration` is added when `enableAutoSessionTracking` is set to `True`
5858

5959
## 6.11.0-beta.0
6060

packages/core/src/js/integrations/default.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable complexity */
2+
import { browserSessionIntegration } from '@sentry/browser';
23
import type { Integration } from '@sentry/core';
34

45
import type { ReactNativeClientOptions } from '../options';
@@ -59,6 +60,10 @@ export function getDefaultIntegrations(options: ReactNativeClientOptions): Integ
5960
integrations.push(browserApiErrorsIntegration());
6061
integrations.push(browserGlobalHandlersIntegration());
6162
integrations.push(browserLinkedErrorsIntegration());
63+
64+
if (options.enableAutoSessionTracking) {
65+
integrations.push(browserSessionIntegration());
66+
}
6267
}
6368

6469
// @sentry/react default integrations

packages/core/test/sdk.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,36 @@ describe('Tests the SDK functionality', () => {
620620
expectIntegration('HermesProfiling');
621621
});
622622

623+
it('adds browserSessionIntegration on web when enableAutoSessionTracking is set true', () => {
624+
(NATIVE.isNativeAvailable as jest.Mock).mockImplementation(() => false);
625+
(notWeb as jest.Mock).mockImplementation(() => false);
626+
init({ enableAutoSessionTracking: true });
627+
628+
expectIntegration('BrowserSession');
629+
});
630+
631+
it('no browserSessionIntegration on web when enableAutoSessionTracking is set false', () => {
632+
(NATIVE.isNativeAvailable as jest.Mock).mockImplementation(() => false);
633+
(notWeb as jest.Mock).mockImplementation(() => false);
634+
init({ enableAutoSessionTracking: false });
635+
636+
expectNotIntegration('BrowserSession');
637+
});
638+
639+
it('no browserSessionIntegration on web when enableAutoSessionTracking is not set', () => {
640+
(NATIVE.isNativeAvailable as jest.Mock).mockImplementation(() => false);
641+
(notWeb as jest.Mock).mockImplementation(() => false);
642+
init({});
643+
644+
expectNotIntegration('BrowserSession');
645+
});
646+
647+
it('no browserSessionIntegration on mobile', () => {
648+
init({ enableAutoSessionTracking: true });
649+
650+
expectNotIntegration('BrowserSession');
651+
});
652+
623653
it('no spotlight integration by default', () => {
624654
init({});
625655

0 commit comments

Comments
 (0)