Skip to content

Commit 05f2a7f

Browse files
alwxantonis
andauthored
fix(tracing): Time To Initial Display / Time To Full Display: remove warning that it's unsupported (#5081)
* improvement(newArch): Time To Initial Display / Time To Full Display implemented via Fabric components * Changelog update --------- Co-authored-by: Antonis Lilis <[email protected]>
1 parent 21c9e75 commit 05f2a7f

File tree

3 files changed

+6
-34
lines changed

3 files changed

+6
-34
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
99
## Unreleased
1010

11+
1112
### Important Changes
1213

1314
- **fix(browser): Ensure IP address is only inferred by Relay if `sendDefaultPii` is `true`** ([#5092](https://github.com/getsentry/sentry-react-native/pull/5092))
@@ -24,6 +25,10 @@ user IP addresses, if you set `sendDefaultPii: true` in your `Sentry.init` optio
2425

2526
We apologize for any inconvenience caused!
2627

28+
## Fixes
29+
30+
- Remove the warning that used to indicate that Time To Initial Display and Time To Full Display are not supported ([#5081](https://github.com/getsentry/sentry-react-native/pull/5081))
31+
2732
## 6.20.0
2833

2934
### Features

packages/core/src/js/tracing/timetodisplay.tsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ import { fill, getActiveSpan, getSpanDescendants, logger, SEMANTIC_ATTRIBUTE_SEN
33
import * as React from 'react';
44
import { useState } from 'react';
55

6-
import { isTurboModuleEnabled } from '../utils/environment';
76
import { SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY } from './origin';
8-
import { getRNSentryOnDrawReporter, nativeComponentExists } from './timetodisplaynative';
7+
import { getRNSentryOnDrawReporter } from './timetodisplaynative';
98
import { setSpanDurationAsMeasurement, setSpanDurationAsMeasurementOnSpan } from './utils';
109

11-
let nativeComponentMissingLogged = false;
12-
1310
/**
1411
* Flags of active spans with manual initial display.
1512
*/
@@ -62,17 +59,6 @@ function TimeToDisplay(props: {
6259
parentSpanId?: string;
6360
}): React.ReactElement {
6461
const RNSentryOnDrawReporter = getRNSentryOnDrawReporter();
65-
const isNewArchitecture = isTurboModuleEnabled();
66-
67-
if (__DEV__ && (isNewArchitecture || (!nativeComponentExists && !nativeComponentMissingLogged))){
68-
nativeComponentMissingLogged = true;
69-
// Using setTimeout with a delay of 0 milliseconds to defer execution and avoid printing the React stack trace.
70-
setTimeout(() => {
71-
logger.warn(
72-
'TimeToInitialDisplay and TimeToFullDisplay are not supported on the web, Expo Go and New Architecture. Run native build or report an issue at https://github.com/getsentry/sentry-react-native');
73-
}, 0);
74-
}
75-
7662
return (
7763
<>
7864
<RNSentryOnDrawReporter

packages/core/test/tracing/timetodisplay.test.tsx

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ jest.mock('../../src/js/wrapper', () => mockWrapper);
77
import * as mockedtimetodisplaynative from './mockedtimetodisplaynative';
88
jest.mock('../../src/js/tracing/timetodisplaynative', () => mockedtimetodisplaynative);
99

10-
import { isTurboModuleEnabled } from '../../src/js/utils/environment';
1110
jest.mock('../../src/js/utils/environment', () => ({
1211
isWeb: jest.fn().mockReturnValue(false),
1312
isTurboModuleEnabled: jest.fn().mockReturnValue(false),
@@ -290,24 +289,6 @@ describe('TimeToDisplay', () => {
290289
expect(getInitialDisplaySpanJSON(client.event!.spans!)!.timestamp).toEqual(initialDisplayEndTimestampMs / 1_000);
291290
expect(getFullDisplaySpanJSON(client.event!.spans!)!.timestamp).toEqual(initialDisplayEndTimestampMs / 1_000);
292291
});
293-
294-
test('should not log a warning if native component exists and not in new architecture', async () => {
295-
(isTurboModuleEnabled as jest.Mock).mockReturnValue(false);
296-
297-
TestRenderer.create(<TimeToInitialDisplay record={true} />);
298-
await jest.runOnlyPendingTimersAsync(); // Flush setTimeout.
299-
300-
expect(logger.warn).not.toHaveBeenCalled();
301-
});
302-
303-
test('should log a warning if in new architecture', async () => {
304-
(isTurboModuleEnabled as jest.Mock).mockReturnValue(true);
305-
TestRenderer.create(<TimeToInitialDisplay record={true} />);
306-
await jest.runOnlyPendingTimersAsync(); // Flush setTimeout.
307-
308-
expect(logger.warn).toHaveBeenCalledWith(
309-
'TimeToInitialDisplay and TimeToFullDisplay are not supported on the web, Expo Go and New Architecture. Run native build or report an issue at https://github.com/getsentry/sentry-react-native');
310-
});
311292
});
312293

313294
function getInitialDisplaySpanJSON(spans: SpanJSON[]) {

0 commit comments

Comments
 (0)