From dcf217cce9368d9f7eb2d8ae15b804bc5ae21d31 Mon Sep 17 00:00:00 2001 From: Alexander Pantiukhov Date: Wed, 13 Aug 2025 12:13:26 +0200 Subject: [PATCH 1/2] improvement(newArch): Time To Initial Display / Time To Full Display implemented via Fabric components --- CHANGELOG.md | 1 + .../core/src/js/tracing/timetodisplay.tsx | 16 +--------------- .../core/test/tracing/timetodisplay.test.tsx | 19 ------------------- 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bb59bc358..3b6d9a06bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ ### Fixes - Correct detection of whether turbo modules are available ([#5064](https://github.com/getsentry/sentry-react-native/pull/5064)) +- 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)) ### Dependencies diff --git a/packages/core/src/js/tracing/timetodisplay.tsx b/packages/core/src/js/tracing/timetodisplay.tsx index f33216b875..6f2ee736fe 100644 --- a/packages/core/src/js/tracing/timetodisplay.tsx +++ b/packages/core/src/js/tracing/timetodisplay.tsx @@ -3,13 +3,10 @@ import { fill, getActiveSpan, getSpanDescendants, logger, SEMANTIC_ATTRIBUTE_SEN import * as React from 'react'; import { useState } from 'react'; -import { isTurboModuleEnabled } from '../utils/environment'; import { SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY } from './origin'; -import { getRNSentryOnDrawReporter, nativeComponentExists } from './timetodisplaynative'; +import { getRNSentryOnDrawReporter } from './timetodisplaynative'; import { setSpanDurationAsMeasurement, setSpanDurationAsMeasurementOnSpan } from './utils'; -let nativeComponentMissingLogged = false; - /** * Flags of active spans with manual initial display. */ @@ -62,17 +59,6 @@ function TimeToDisplay(props: { parentSpanId?: string; }): React.ReactElement { const RNSentryOnDrawReporter = getRNSentryOnDrawReporter(); - const isNewArchitecture = isTurboModuleEnabled(); - - if (__DEV__ && (isNewArchitecture || (!nativeComponentExists && !nativeComponentMissingLogged))){ - nativeComponentMissingLogged = true; - // Using setTimeout with a delay of 0 milliseconds to defer execution and avoid printing the React stack trace. - setTimeout(() => { - logger.warn( - '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'); - }, 0); - } - return ( <> mockWrapper); import * as mockedtimetodisplaynative from './mockedtimetodisplaynative'; jest.mock('../../src/js/tracing/timetodisplaynative', () => mockedtimetodisplaynative); -import { isTurboModuleEnabled } from '../../src/js/utils/environment'; jest.mock('../../src/js/utils/environment', () => ({ isWeb: jest.fn().mockReturnValue(false), isTurboModuleEnabled: jest.fn().mockReturnValue(false), @@ -290,24 +289,6 @@ describe('TimeToDisplay', () => { expect(getInitialDisplaySpanJSON(client.event!.spans!)!.timestamp).toEqual(initialDisplayEndTimestampMs / 1_000); expect(getFullDisplaySpanJSON(client.event!.spans!)!.timestamp).toEqual(initialDisplayEndTimestampMs / 1_000); }); - - test('should not log a warning if native component exists and not in new architecture', async () => { - (isTurboModuleEnabled as jest.Mock).mockReturnValue(false); - - TestRenderer.create(); - await jest.runOnlyPendingTimersAsync(); // Flush setTimeout. - - expect(logger.warn).not.toHaveBeenCalled(); - }); - - test('should log a warning if in new architecture', async () => { - (isTurboModuleEnabled as jest.Mock).mockReturnValue(true); - TestRenderer.create(); - await jest.runOnlyPendingTimersAsync(); // Flush setTimeout. - - expect(logger.warn).toHaveBeenCalledWith( - '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'); - }); }); function getInitialDisplaySpanJSON(spans: SpanJSON[]) { From f0bf3b67ce0f68f9381f764824b2aa8344cc9bcf Mon Sep 17 00:00:00 2001 From: Alexander Pantiukhov Date: Thu, 14 Aug 2025 15:27:21 +0200 Subject: [PATCH 2/2] Changelog update --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b6d9a06bf..ad32e2a3d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ > make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first. +## Unreleased + +## Fixes + +- 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)) + ## 6.20.0 ### Features @@ -17,7 +23,6 @@ ### Fixes - Correct detection of whether turbo modules are available ([#5064](https://github.com/getsentry/sentry-react-native/pull/5064)) -- 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)) ### Dependencies