From bde51a3cebf34ce8ca15151a1940db9e70fc76b3 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 20 Mar 2024 19:20:50 +0100 Subject: [PATCH 1/4] fix(timetodisplay): Change TimeToDisplay unsupported log from error to warning level --- CHANGELOG.md | 6 ++++++ src/js/tracing/timetodisplay.tsx | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad7b02e2a0..a8bbf4224e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- Change TimeToDisplay unsupported log from error to warning level. ([#3699](https://github.com/getsentry/sentry-react-native/pull/3699)) + ## 5.20.0 ### Features diff --git a/src/js/tracing/timetodisplay.tsx b/src/js/tracing/timetodisplay.tsx index 528fce41e5..ff5d829b97 100644 --- a/src/js/tracing/timetodisplay.tsx +++ b/src/js/tracing/timetodisplay.tsx @@ -61,7 +61,7 @@ function TimeToDisplay(props: { if (__DEV__ && !nativeComponentMissingLogged && !nativeComponentExists) { nativeComponentMissingLogged = true; - logger.error('RNSentryOnDrawReporter is not available on the web, Expo Go and New Architecture. Run native build or report an issue at https://github.com/getsentry/sentry-react-native'); + logger.warn('RNSentryOnDrawReporter is not available on the web, Expo Go and New Architecture. Run native build or report an issue at https://github.com/getsentry/sentry-react-native'); } const onDraw = (event: { nativeEvent: RNSentryOnDrawNextFrameEvent }): void => onDrawNextFrame(event); From b5627666910a7d23b1e24ff3a6cfc62756304c7f Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 20 Mar 2024 19:28:43 +0100 Subject: [PATCH 2/4] Update the message to log to remove useless stack trace and update the error message. --- src/js/tracing/timetodisplay.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/tracing/timetodisplay.tsx b/src/js/tracing/timetodisplay.tsx index ff5d829b97..acb5ad05f5 100644 --- a/src/js/tracing/timetodisplay.tsx +++ b/src/js/tracing/timetodisplay.tsx @@ -61,7 +61,7 @@ function TimeToDisplay(props: { if (__DEV__ && !nativeComponentMissingLogged && !nativeComponentExists) { nativeComponentMissingLogged = true; - logger.warn('RNSentryOnDrawReporter is not available on the web, Expo Go and New Architecture. Run native build or report an issue at https://github.com/getsentry/sentry-react-native'); + logger.log('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'); } const onDraw = (event: { nativeEvent: RNSentryOnDrawNextFrameEvent }): void => onDrawNextFrame(event); From f36f91694724555215b15155f6b5f7c5895d0cd2 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Thu, 21 Mar 2024 16:38:01 +0100 Subject: [PATCH 3/4] Use warn with timeout to remove the stack trace --- src/js/tracing/timetodisplay.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/tracing/timetodisplay.tsx b/src/js/tracing/timetodisplay.tsx index acb5ad05f5..d3d3952922 100644 --- a/src/js/tracing/timetodisplay.tsx +++ b/src/js/tracing/timetodisplay.tsx @@ -61,7 +61,9 @@ function TimeToDisplay(props: { if (__DEV__ && !nativeComponentMissingLogged && !nativeComponentExists) { nativeComponentMissingLogged = true; - logger.log('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'); + 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); } const onDraw = (event: { nativeEvent: RNSentryOnDrawNextFrameEvent }): void => onDrawNextFrame(event); From 9f71039330bf3cac111ee98a6c6d6617ac818569 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich <31292499+krystofwoldrich@users.noreply.github.com> Date: Tue, 16 Apr 2024 16:07:55 +0200 Subject: [PATCH 4/4] Update src/js/tracing/timetodisplay.tsx Co-authored-by: LucasZF --- src/js/tracing/timetodisplay.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/js/tracing/timetodisplay.tsx b/src/js/tracing/timetodisplay.tsx index d3d3952922..75fc92bedd 100644 --- a/src/js/tracing/timetodisplay.tsx +++ b/src/js/tracing/timetodisplay.tsx @@ -61,6 +61,7 @@ function TimeToDisplay(props: { if (__DEV__ && !nativeComponentMissingLogged && !nativeComponentExists) { 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);