Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
> make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first.
<!-- prettier-ignore-end -->

## Unreleased

### Fixes

- Reduce `reactNavigationIntegration` performance overhead ([#5840](https://github.com/getsentry/sentry-react-native/pull/5840), [#5842](https://github.com/getsentry/sentry-react-native/pull/5842), [#5849](https://github.com/getsentry/sentry-react-native/pull/5849))
Comment thread
antonis marked this conversation as resolved.
- Fix duplicated breadcrumbs on Android ([#5841](https://github.com/getsentry/sentry-react-native/pull/5841))

## 8.5.0

### Features
Expand All @@ -22,7 +29,6 @@

- Fix native frames measurements being dropped due to race condition ([#5813](https://github.com/getsentry/sentry-react-native/pull/5813))
- Fix app start data lost when first navigation transaction is discarded ([#5833](https://github.com/getsentry/sentry-react-native/pull/5833))
- Fix duplicated breadcrumbs on Android ([#5841](https://github.com/getsentry/sentry-react-native/pull/5841))

### Dependencies

Expand Down
7 changes: 6 additions & 1 deletion packages/core/src/js/tracing/reactnavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ interface ReactNavigationIntegrationOptions {
* Time to initial display measures the time it takes from
* navigation dispatch to the render of the first frame of the new screen.
*
* Note: Enabling this adds native bridge calls on every navigation
* which may cause noticeable overhead on low-end devices.
*
* @default false
*/
enableTimeToInitialDisplay: boolean;
Expand Down Expand Up @@ -438,7 +441,9 @@ export const reactNavigationIntegration = ({
return undefined;
}

addTimeToInitialDisplayFallback(latestNavigationSpan.spanContext().spanId, NATIVE.getNewScreenTimeToDisplay());
if (enableTimeToInitialDisplay) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Q: should we mention the performance overhead when enabling this on changelog/docs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've added a note in the parameter documentation dd81064
I'll try to measure the actual performance overhead and update the doc accordingly

addTimeToInitialDisplayFallback(latestNavigationSpan.spanContext().spanId, NATIVE.getNewScreenTimeToDisplay());
}

if (previousRoute?.key === route.key) {
debug.log(`[${INTEGRATION_NAME}] Navigation state changed, but route is the same as previous.`);
Expand Down
10 changes: 10 additions & 0 deletions packages/core/test/tracing/reactnavigation.ttid.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,16 @@ describe('React Navigation - TTID', () => {
}),
);
});

test('should not call getNewScreenTimeToDisplay when ttid is disabled', () => {
jest.runOnlyPendingTimers(); // Flush app start transaction

mockWrapper.NATIVE.getNewScreenTimeToDisplay.mockClear();
mockedNavigation.navigateToNewScreen();
jest.runOnlyPendingTimers(); // Flush navigation transaction

expect(mockWrapper.NATIVE.getNewScreenTimeToDisplay).not.toHaveBeenCalled();
});
});

describe('ttid for preloaded/seen routes', () => {
Expand Down
Loading