From 94f9bd2d79f11b6ae5391785aead94734e0db489 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Thu, 31 Oct 2024 16:43:07 +0100 Subject: [PATCH 01/22] chore: remove the homepage_initial_render event --- contributingGuides/PERFORMANCE_METRICS.md | 3 +-- src/CONST.ts | 1 - src/libs/Navigation/AppNavigator/AuthScreens.tsx | 4 ---- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/contributingGuides/PERFORMANCE_METRICS.md b/contributingGuides/PERFORMANCE_METRICS.md index 6c40e346a3ce..ad9a6509f7ae 100644 --- a/contributingGuides/PERFORMANCE_METRICS.md +++ b/contributingGuides/PERFORMANCE_METRICS.md @@ -14,7 +14,6 @@ Project is using Firebase for tracking these metrics. However, not all of them a | `js_loaded` | ✅ | The time it takes for the JavaScript bundle to load.

**Platforms:** Android, iOS | **Android:** Starts in the `onCreate` method.

**iOS:** Starts in the AppDelegate's `didFinishLaunchingWithOptions` method. | Stops at the first render of the app via native module on the JS side. | | `_app_in_foreground` | ✅ | The time when the app is running in the foreground and available to the user.

**Platforms:** Android, iOS | **Android:** Starts when the first activity to reach the foreground has its `onResume()` method called.

**iOS:** Starts when the application receives the `UIApplicationDidBecomeActiveNotification` notification. | **Android:** Stops when the last activity to leave the foreground has its `onStop()` method called.

**iOS:** Stops when it receives the `UIApplicationWillResignActiveNotification` notification. | | `_app_in_background` | ✅ | Time when the app is running in the background.

**Platforms:** Android, iOS | **Android:** Starts when the last activity to leave the foreground has its `onStop()` method called.

**iOS:** Starts when the application receives the `UIApplicationWillResignActiveNotification` notification. | **Android:** Stops when the first activity to reach the foreground has its `onResume()` method called.

**iOS:** Stops when it receives the `UIApplicationDidBecomeActiveNotification` notification. | -| `homepage_initial_render` | ✅ | Time taken for the initial render of the app for a logged in user.

**Platforms:** All | Starts with the first render of the `AuthScreens` component. | Stops once the `AuthScreens` component is mounted. | | `sidebar_loaded` | ❌ | Time taken for the Sidebar to load.

**Platforms:** All | Starts when the Sidebar is mounted. | Stops when the Splash Screen is hidden. | | `calc_most_recent_last_modified_action` | ✅ | Time taken to find the most recently modified report action or report.

**Platforms:** All | Starts when the app reconnects to the network | Ends when the app reconnects to the network and the most recent report action or report is found. | | `search_render` | ✅ | Time taken to render the Chat Finder page.

**Platforms:** All | Starts when the Chat Finder icon in LHN is pressed. | Stops when the list of available options is rendered for the first time. | @@ -46,4 +45,4 @@ To ensure this documentation remains accurate and useful, please adhere to the f ## Additional Resources - [Firebase Documentation](https://firebase.google.com/docs) -- [Firebase Performance Monitoring](https://firebase.google.com/docs/perf-mon) \ No newline at end of file +- [Firebase Performance Monitoring](https://firebase.google.com/docs/perf-mon) diff --git a/src/CONST.ts b/src/CONST.ts index d93eb230f779..79a18ab2f588 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1256,7 +1256,6 @@ const CONST = { SEARCH_ROUTER_RENDER: 'search_router_render', CHAT_RENDER: 'chat_render', OPEN_REPORT: 'open_report', - HOMEPAGE_INITIAL_RENDER: 'homepage_initial_render', REPORT_INITIAL_RENDER: 'report_initial_render', SWITCH_REPORT: 'switch_report', OPEN_REPORT_FROM_PREVIEW: 'open_report_from_preview', diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index 58586250f958..d7f3cd2e80cc 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -248,8 +248,6 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie // eslint-disable-next-line react-compiler/react-compiler if (isInitialRender.current) { - Timing.start(CONST.TIMING.HOMEPAGE_INITIAL_RENDER); - const currentURL = getCurrentUrl(); if (currentURL) { initialReportID = new URL(currentURL).pathname.match(CONST.REGEX.REPORT_ID_FROM_PATH)?.at(1); @@ -313,8 +311,6 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie } Download.clearDownloads(); - Timing.end(CONST.TIMING.HOMEPAGE_INITIAL_RENDER); - const unsubscribeOnyxModal = onyxSubscribe({ key: ONYXKEYS.MODAL, callback: (modalArg) => { From 647c3f129d0b63f23161de6c121299406e4c0194 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Thu, 31 Oct 2024 16:57:10 +0100 Subject: [PATCH 02/22] chore: remove the chat_render event --- contributingGuides/PERFORMANCE_METRICS.md | 1 - src/CONST.ts | 1 - src/libs/E2E/tests/chatOpeningTest.e2e.ts | 16 ---------------- src/pages/home/ReportScreen.tsx | 9 +-------- 4 files changed, 1 insertion(+), 26 deletions(-) diff --git a/contributingGuides/PERFORMANCE_METRICS.md b/contributingGuides/PERFORMANCE_METRICS.md index ad9a6509f7ae..bb0c4a55e4f0 100644 --- a/contributingGuides/PERFORMANCE_METRICS.md +++ b/contributingGuides/PERFORMANCE_METRICS.md @@ -24,7 +24,6 @@ Project is using Firebase for tracking these metrics. However, not all of them a | `switch_report` | ✅ | Time taken to open report.

**Platforms:** All | Starts when the chat in the LHN is pressed. | Stops when the `ReportActionsList` finishes laying out. | | `open_report_from_preview` | ✅ | Time taken to open a report from preview.

(previously `switch_report_from_preview`)

**Platforms:** All | Starts when the user presses the Report Preview. | Stops when the `ReportActionsList` finishes laying out. | | `switch_report_from_preview` | ❌ | **[REMOVED]** Time taken to open a report from preview. | Starts when the user presses the Report Preview. | Stops when the `ReportActionsList` finishes laying out. | -| `chat_render` | ✅ | Time taken to render the Report screen.

**Platforms:** All | Starts when the `ReportScreen` is being rendered for the first time. | Stops once the `ReportScreen` component is mounted. | | `report_initial_render` | ❌ | Time taken to render the Report screen.

**Platforms:** All | Starts when the first item is rendered in the `LHNOptionsList`. | Stops when the `ReportActionsList` finishes laying out. | | `open_report_thread` | ✅ | Time taken to open a thread in a report.

**Platforms:** All | Starts when user presses Report Action Item. | Stops when the `ReportActionsList` finishes laying out. | | `message_sent` | ❌ | Time taken to send a message.

**Platforms:** All | Starts when the new message is sent. | Stops when the message is being rendered in the chat. | diff --git a/src/CONST.ts b/src/CONST.ts index 79a18ab2f588..b511c2343791 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1254,7 +1254,6 @@ const CONST = { TIMING: { CALCULATE_MOST_RECENT_LAST_MODIFIED_ACTION: 'calc_most_recent_last_modified_action', SEARCH_ROUTER_RENDER: 'search_router_render', - CHAT_RENDER: 'chat_render', OPEN_REPORT: 'open_report', REPORT_INITIAL_RENDER: 'report_initial_render', SWITCH_REPORT: 'switch_report', diff --git a/src/libs/E2E/tests/chatOpeningTest.e2e.ts b/src/libs/E2E/tests/chatOpeningTest.e2e.ts index cf0c4889aa69..82fd00fd975d 100644 --- a/src/libs/E2E/tests/chatOpeningTest.e2e.ts +++ b/src/libs/E2E/tests/chatOpeningTest.e2e.ts @@ -46,22 +46,6 @@ const test = (config: NativeConfig) => { console.debug(`[E2E] Entry: ${JSON.stringify(entry)}`); - if (entry.name === CONST.TIMING.CHAT_RENDER) { - E2EClient.submitTestResults({ - branch: Config.E2E_BRANCH, - name: `${name} Chat opening`, - metric: entry.duration, - unit: 'ms', - }) - .then(() => { - console.debug('[E2E] Done with chat opening, exiting…'); - renderChatResolve(); - }) - .catch((err) => { - console.debug('[E2E] Error while submitting test results:', err); - }); - } - if (entry.name === CONST.TIMING.OPEN_REPORT) { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index 4c3ed5c705a5..cbc5b72730b5 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -230,11 +230,7 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro const [scrollPosition, setScrollPosition] = useState({}); const wasReportAccessibleRef = useRef(false); - // eslint-disable-next-line react-compiler/react-compiler - if (firstRenderRef.current) { - Timing.start(CONST.TIMING.CHAT_RENDER); - Performance.markStart(CONST.TIMING.CHAT_RENDER); - } + const [isComposerFocus, setIsComposerFocus] = useState(false); const shouldAdjustScrollView = useMemo(() => isComposerFocus && !modal?.willAlertModalBecomeVisible, [isComposerFocus, modal]); const viewportOffsetTop = useViewportOffsetTop(shouldAdjustScrollView); @@ -487,9 +483,6 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro useAppFocusEvent(clearNotifications); useEffect(() => { - Timing.end(CONST.TIMING.CHAT_RENDER); - Performance.markEnd(CONST.TIMING.CHAT_RENDER); - const interactionTask = InteractionManager.runAfterInteractions(() => { ComposerActions.setShouldShowComposeInput(true); }); From cb25dc4cd690bd063467b8b5891befbd98ce951c Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Thu, 31 Oct 2024 17:12:42 +0100 Subject: [PATCH 03/22] chore: remove the report_initial_render event --- contributingGuides/PERFORMANCE_METRICS.md | 1 - src/CONST.ts | 1 - src/libs/E2E/tests/chatOpeningTest.e2e.ts | 2 +- src/libs/E2E/tests/linkingTest.e2e.ts | 11 ----------- src/libs/actions/App.ts | 1 - src/pages/home/report/ReportActionsView.tsx | 1 - 6 files changed, 1 insertion(+), 16 deletions(-) diff --git a/contributingGuides/PERFORMANCE_METRICS.md b/contributingGuides/PERFORMANCE_METRICS.md index bb0c4a55e4f0..29cead03a774 100644 --- a/contributingGuides/PERFORMANCE_METRICS.md +++ b/contributingGuides/PERFORMANCE_METRICS.md @@ -24,7 +24,6 @@ Project is using Firebase for tracking these metrics. However, not all of them a | `switch_report` | ✅ | Time taken to open report.

**Platforms:** All | Starts when the chat in the LHN is pressed. | Stops when the `ReportActionsList` finishes laying out. | | `open_report_from_preview` | ✅ | Time taken to open a report from preview.

(previously `switch_report_from_preview`)

**Platforms:** All | Starts when the user presses the Report Preview. | Stops when the `ReportActionsList` finishes laying out. | | `switch_report_from_preview` | ❌ | **[REMOVED]** Time taken to open a report from preview. | Starts when the user presses the Report Preview. | Stops when the `ReportActionsList` finishes laying out. | -| `report_initial_render` | ❌ | Time taken to render the Report screen.

**Platforms:** All | Starts when the first item is rendered in the `LHNOptionsList`. | Stops when the `ReportActionsList` finishes laying out. | | `open_report_thread` | ✅ | Time taken to open a thread in a report.

**Platforms:** All | Starts when user presses Report Action Item. | Stops when the `ReportActionsList` finishes laying out. | | `message_sent` | ❌ | Time taken to send a message.

**Platforms:** All | Starts when the new message is sent. | Stops when the message is being rendered in the chat. | diff --git a/src/CONST.ts b/src/CONST.ts index b511c2343791..7361b6561345 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1255,7 +1255,6 @@ const CONST = { CALCULATE_MOST_RECENT_LAST_MODIFIED_ACTION: 'calc_most_recent_last_modified_action', SEARCH_ROUTER_RENDER: 'search_router_render', OPEN_REPORT: 'open_report', - REPORT_INITIAL_RENDER: 'report_initial_render', SWITCH_REPORT: 'switch_report', OPEN_REPORT_FROM_PREVIEW: 'open_report_from_preview', OPEN_REPORT_THREAD: 'open_report_thread', diff --git a/src/libs/E2E/tests/chatOpeningTest.e2e.ts b/src/libs/E2E/tests/chatOpeningTest.e2e.ts index 82fd00fd975d..40e5d2677090 100644 --- a/src/libs/E2E/tests/chatOpeningTest.e2e.ts +++ b/src/libs/E2E/tests/chatOpeningTest.e2e.ts @@ -27,7 +27,7 @@ const test = (config: NativeConfig) => { console.debug('[E2E] Logged in, getting chat opening metrics and submitting them…'); - const [renderChatPromise, renderChatResolve] = getPromiseWithResolve(); + const [renderChatPromise] = getPromiseWithResolve(); const [chatTTIPromise, chatTTIResolve] = getPromiseWithResolve(); Promise.all([renderChatPromise, chatTTIPromise]).then(() => { diff --git a/src/libs/E2E/tests/linkingTest.e2e.ts b/src/libs/E2E/tests/linkingTest.e2e.ts index 18ba438c2ca6..441d6d76a042 100644 --- a/src/libs/E2E/tests/linkingTest.e2e.ts +++ b/src/libs/E2E/tests/linkingTest.e2e.ts @@ -1,7 +1,6 @@ import {DeviceEventEmitter} from 'react-native'; import type {NativeConfig} from 'react-native-config'; import Config from 'react-native-config'; -import Timing from '@libs/actions/Timing'; import E2ELogin from '@libs/E2E/actions/e2eLogin'; import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded'; import E2EClient from '@libs/E2E/client'; @@ -22,7 +21,6 @@ const test = (config: NativeConfig) => { console.debug('[E2E] Logging in for comment linking'); const reportID = getConfigValueOrThrow('reportID', config); - const linkedReportID = getConfigValueOrThrow('linkedReportID', config); const linkedReportActionID = getConfigValueOrThrow('linkedReportActionID', config); const name = getConfigValueOrThrow('name', config); @@ -61,15 +59,6 @@ const test = (config: NativeConfig) => { return; } - if (entry.name === CONST.TIMING.REPORT_INITIAL_RENDER) { - console.debug('[E2E] Navigating to linked report action…'); - Timing.start(CONST.TIMING.SWITCH_REPORT); - Performance.markStart(CONST.TIMING.SWITCH_REPORT); - - Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(linkedReportID, linkedReportActionID)); - return; - } - if (entry.name === CONST.TIMING.SWITCH_REPORT) { console.debug('[E2E] Linking: 1'); diff --git a/src/libs/actions/App.ts b/src/libs/actions/App.ts index 5a594a19e15a..7fe1745285fb 100644 --- a/src/libs/actions/App.ts +++ b/src/libs/actions/App.ts @@ -179,7 +179,6 @@ function setSidebarLoaded() { } Onyx.set(ONYXKEYS.IS_SIDEBAR_LOADED, true); - Performance.markStart(CONST.TIMING.REPORT_INITIAL_RENDER); } let appState: AppStateStatus; diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx index 8896611905ca..21a05f7567dc 100755 --- a/src/pages/home/report/ReportActionsView.tsx +++ b/src/pages/home/report/ReportActionsView.tsx @@ -430,7 +430,6 @@ function ReportActionsView({ // Capture the init measurement only once not per each chat switch as the value gets overwritten if (!ReportActionsView.initMeasured) { Performance.markEnd(CONST.TIMING.OPEN_REPORT); - Performance.markEnd(CONST.TIMING.REPORT_INITIAL_RENDER); ReportActionsView.initMeasured = true; } else { Performance.markEnd(CONST.TIMING.SWITCH_REPORT); From 67a7ec819cc678e950bcd1d195abc56211d25ff5 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Thu, 31 Oct 2024 17:36:22 +0100 Subject: [PATCH 04/22] chore: remove the sidebar_loaded event --- contributingGuides/PERFORMANCE_METRICS.md | 1 - src/CONST.ts | 1 - src/Expensify.tsx | 1 - src/libs/E2E/tests/chatOpeningTest.e2e.ts | 10 -------- src/libs/E2E/tests/linkingTest.e2e.ts | 9 ------- .../E2E/tests/openSearchRouterTest.e2e.ts | 24 ------------------- src/libs/E2E/tests/reportTypingTest.e2e.ts | 4 ---- src/libs/Performance.tsx | 4 ---- .../SidebarScreen/BaseSidebarScreen.tsx | 5 ---- 9 files changed, 59 deletions(-) diff --git a/contributingGuides/PERFORMANCE_METRICS.md b/contributingGuides/PERFORMANCE_METRICS.md index 29cead03a774..56db207b2425 100644 --- a/contributingGuides/PERFORMANCE_METRICS.md +++ b/contributingGuides/PERFORMANCE_METRICS.md @@ -14,7 +14,6 @@ Project is using Firebase for tracking these metrics. However, not all of them a | `js_loaded` | ✅ | The time it takes for the JavaScript bundle to load.

**Platforms:** Android, iOS | **Android:** Starts in the `onCreate` method.

**iOS:** Starts in the AppDelegate's `didFinishLaunchingWithOptions` method. | Stops at the first render of the app via native module on the JS side. | | `_app_in_foreground` | ✅ | The time when the app is running in the foreground and available to the user.

**Platforms:** Android, iOS | **Android:** Starts when the first activity to reach the foreground has its `onResume()` method called.

**iOS:** Starts when the application receives the `UIApplicationDidBecomeActiveNotification` notification. | **Android:** Stops when the last activity to leave the foreground has its `onStop()` method called.

**iOS:** Stops when it receives the `UIApplicationWillResignActiveNotification` notification. | | `_app_in_background` | ✅ | Time when the app is running in the background.

**Platforms:** Android, iOS | **Android:** Starts when the last activity to leave the foreground has its `onStop()` method called.

**iOS:** Starts when the application receives the `UIApplicationWillResignActiveNotification` notification. | **Android:** Stops when the first activity to reach the foreground has its `onResume()` method called.

**iOS:** Stops when it receives the `UIApplicationDidBecomeActiveNotification` notification. | -| `sidebar_loaded` | ❌ | Time taken for the Sidebar to load.

**Platforms:** All | Starts when the Sidebar is mounted. | Stops when the Splash Screen is hidden. | | `calc_most_recent_last_modified_action` | ✅ | Time taken to find the most recently modified report action or report.

**Platforms:** All | Starts when the app reconnects to the network | Ends when the app reconnects to the network and the most recent report action or report is found. | | `search_render` | ✅ | Time taken to render the Chat Finder page.

**Platforms:** All | Starts when the Chat Finder icon in LHN is pressed. | Stops when the list of available options is rendered for the first time. | | `load_search_options` | ✅ | Time taken to generate the list of options used in Chat Finder.

**Platforms:** All | Starts when the `getSearchOptions` function is called. | Stops when the list of available options is generated. | diff --git a/src/CONST.ts b/src/CONST.ts index 7361b6561345..b1a88118ac2a 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1258,7 +1258,6 @@ const CONST = { SWITCH_REPORT: 'switch_report', OPEN_REPORT_FROM_PREVIEW: 'open_report_from_preview', OPEN_REPORT_THREAD: 'open_report_thread', - SIDEBAR_LOADED: 'sidebar_loaded', LOAD_SEARCH_OPTIONS: 'load_search_options', MESSAGE_SENT: 'message_sent', COLD: 'cold', diff --git a/src/Expensify.tsx b/src/Expensify.tsx index e07b03a6d405..40e937af2d1b 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -138,7 +138,6 @@ function Expensify() { const onSplashHide = useCallback(() => { setSplashScreenState(CONST.BOOT_SPLASH_STATE.HIDDEN); - Performance.markEnd(CONST.TIMING.SIDEBAR_LOADED); }, [setSplashScreenState]); useLayoutEffect(() => { diff --git a/src/libs/E2E/tests/chatOpeningTest.e2e.ts b/src/libs/E2E/tests/chatOpeningTest.e2e.ts index 40e5d2677090..f7ec35018028 100644 --- a/src/libs/E2E/tests/chatOpeningTest.e2e.ts +++ b/src/libs/E2E/tests/chatOpeningTest.e2e.ts @@ -5,16 +5,13 @@ import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded'; import E2EClient from '@libs/E2E/client'; import getConfigValueOrThrow from '@libs/E2E/utils/getConfigValueOrThrow'; import getPromiseWithResolve from '@libs/E2E/utils/getPromiseWithResolve'; -import Navigation from '@libs/Navigation/Navigation'; import Performance from '@libs/Performance'; import CONST from '@src/CONST'; -import ROUTES from '@src/ROUTES'; const test = (config: NativeConfig) => { // check for login (if already logged in the action will simply resolve) console.debug('[E2E] Logging in for chat opening'); - const reportID = getConfigValueOrThrow('reportID', config); const name = getConfigValueOrThrow('name', config); E2ELogin().then((neededLogin) => { @@ -37,13 +34,6 @@ const test = (config: NativeConfig) => { }); Performance.subscribeToMeasurements((entry) => { - if (entry.name === CONST.TIMING.SIDEBAR_LOADED) { - console.debug(`[E2E] Sidebar loaded, navigating to report…`); - Performance.markStart(CONST.TIMING.OPEN_REPORT); - Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); - return; - } - console.debug(`[E2E] Entry: ${JSON.stringify(entry)}`); if (entry.name === CONST.TIMING.OPEN_REPORT) { diff --git a/src/libs/E2E/tests/linkingTest.e2e.ts b/src/libs/E2E/tests/linkingTest.e2e.ts index 441d6d76a042..b517d91658b4 100644 --- a/src/libs/E2E/tests/linkingTest.e2e.ts +++ b/src/libs/E2E/tests/linkingTest.e2e.ts @@ -6,10 +6,8 @@ import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded'; import E2EClient from '@libs/E2E/client'; import getConfigValueOrThrow from '@libs/E2E/utils/getConfigValueOrThrow'; import getPromiseWithResolve from '@libs/E2E/utils/getPromiseWithResolve'; -import Navigation from '@libs/Navigation/Navigation'; import Performance from '@libs/Performance'; import CONST from '@src/CONST'; -import ROUTES from '@src/ROUTES'; type ViewableItem = { reportActionID?: string; @@ -20,7 +18,6 @@ type ViewableItemResponse = Array<{item?: ViewableItem}>; const test = (config: NativeConfig) => { console.debug('[E2E] Logging in for comment linking'); - const reportID = getConfigValueOrThrow('reportID', config); const linkedReportActionID = getConfigValueOrThrow('linkedReportActionID', config); const name = getConfigValueOrThrow('name', config); @@ -53,12 +50,6 @@ const test = (config: NativeConfig) => { }); Performance.subscribeToMeasurements((entry) => { - if (entry.name === CONST.TIMING.SIDEBAR_LOADED) { - console.debug('[E2E] Sidebar loaded, navigating to a report…'); - Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); - return; - } - if (entry.name === CONST.TIMING.SWITCH_REPORT) { console.debug('[E2E] Linking: 1'); diff --git a/src/libs/E2E/tests/openSearchRouterTest.e2e.ts b/src/libs/E2E/tests/openSearchRouterTest.e2e.ts index de9464c9c286..f3741f2e2b53 100644 --- a/src/libs/E2E/tests/openSearchRouterTest.e2e.ts +++ b/src/libs/E2E/tests/openSearchRouterTest.e2e.ts @@ -1,6 +1,5 @@ import Config from 'react-native-config'; import type {NativeConfig} from 'react-native-config'; -import * as E2EGenericPressableWrapper from '@components/Pressable/GenericPressable/index.e2e'; import E2ELogin from '@libs/E2E/actions/e2eLogin'; import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded'; import E2EClient from '@libs/E2E/client'; @@ -36,29 +35,6 @@ const test = (config: NativeConfig) => { Performance.subscribeToMeasurements((entry) => { console.debug(`[E2E] Entry: ${JSON.stringify(entry)}`); - if (entry.name === CONST.TIMING.SIDEBAR_LOADED) { - const props = E2EGenericPressableWrapper.getPressableProps('searchButton'); - if (!props) { - console.debug('[E2E] Search button not found, failing test!'); - E2EClient.submitTestResults({ - branch: Config.E2E_BRANCH, - error: 'Search button not found', - name: `${name} Open Search Router TTI`, - }).then(() => E2EClient.submitTestDone()); - return; - } - if (!props.onPress) { - console.debug('[E2E] Search button found but onPress prop was not present, failing test!'); - E2EClient.submitTestResults({ - branch: Config.E2E_BRANCH, - error: 'Search button found but onPress prop was not present', - name: `${name} Open Search Router TTI`, - }).then(() => E2EClient.submitTestDone()); - return; - } - // Open the search router - props.onPress(); - } if (entry.name === CONST.TIMING.SEARCH_ROUTER_RENDER) { E2EClient.submitTestResults({ diff --git a/src/libs/E2E/tests/reportTypingTest.e2e.ts b/src/libs/E2E/tests/reportTypingTest.e2e.ts index e042a688c37d..f25859194541 100644 --- a/src/libs/E2E/tests/reportTypingTest.e2e.ts +++ b/src/libs/E2E/tests/reportTypingTest.e2e.ts @@ -53,10 +53,6 @@ const test = (config: NativeConfig) => { return; } - if (entry.name !== CONST.TIMING.SIDEBAR_LOADED) { - return; - } - console.debug(`[E2E] Sidebar loaded, navigating to a report…`); // Crowded Policy (Do Not Delete) Report, has a input bar available: Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); diff --git a/src/libs/Performance.tsx b/src/libs/Performance.tsx index ef2b08e47229..6d9319276f9a 100644 --- a/src/libs/Performance.tsx +++ b/src/libs/Performance.tsx @@ -160,10 +160,6 @@ if (Metrics.canCapturePerformanceMetrics()) { } // Capture any custom measures or metrics below - if (mark.name === `${CONST.TIMING.SIDEBAR_LOADED}_end`) { - Performance.measureFailSafe('contentAppeared_To_screenTTI', 'contentAppeared', mark.name); - Performance.measureTTI(mark.name); - } }); }).observe({type: 'mark', buffered: true}); }; diff --git a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx index e77f2000b85f..3421d72270fc 100644 --- a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx +++ b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx @@ -31,11 +31,6 @@ function BaseSidebarScreen() { const {shouldUseNarrowLayout} = useResponsiveLayout(); const [activeWorkspace] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activeWorkspaceID ?? -1}`); - useEffect(() => { - Performance.markStart(CONST.TIMING.SIDEBAR_LOADED); - Timing.start(CONST.TIMING.SIDEBAR_LOADED); - }, []); - useEffect(() => { if (!!activeWorkspace || activeWorkspaceID === undefined) { return; From fbc01be3e5aae6261fe2bf3dc79e7b936889ec7c Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Thu, 31 Oct 2024 17:46:34 +0100 Subject: [PATCH 05/22] chore: remove the switch_report event --- contributingGuides/PERFORMANCE_METRICS.md | 2 -- src/CONST.ts | 1 - src/libs/E2E/tests/linkingTest.e2e.ts | 21 +------------------ src/pages/home/report/ReportActionsView.tsx | 15 +++---------- src/pages/home/sidebar/SidebarLinks.tsx | 8 ++----- src/pages/home/sidebar/SidebarLinksData.tsx | 14 +++---------- .../SidebarScreen/BaseSidebarScreen.tsx | 16 +------------- tests/utils/LHNTestUtils.tsx | 1 - 8 files changed, 10 insertions(+), 68 deletions(-) diff --git a/contributingGuides/PERFORMANCE_METRICS.md b/contributingGuides/PERFORMANCE_METRICS.md index 56db207b2425..36ffc6ee3b8d 100644 --- a/contributingGuides/PERFORMANCE_METRICS.md +++ b/contributingGuides/PERFORMANCE_METRICS.md @@ -20,9 +20,7 @@ Project is using Firebase for tracking these metrics. However, not all of them a | `search_filter_options` | ✅ | Time taken to filter search options in Chat Finder by given search value.

**Platforms:** All | Starts when user types something in the Chat Finder search input. | Stops when the list of filtered options is generated. | | `trie_initialization` | ✅ | Time taken to build the emoji trie.

**Platforms:** All | Starts when emoji trie begins to build. | Stops when emoji trie building is complete. | | `open_report` | ❌ | Time taken to open a report.

**Platforms:** All | Starts when the row in the `LHNOptionsList` is pressed. | Stops when the `ReportActionsList` finishes laying out. | -| `switch_report` | ✅ | Time taken to open report.

**Platforms:** All | Starts when the chat in the LHN is pressed. | Stops when the `ReportActionsList` finishes laying out. | | `open_report_from_preview` | ✅ | Time taken to open a report from preview.

(previously `switch_report_from_preview`)

**Platforms:** All | Starts when the user presses the Report Preview. | Stops when the `ReportActionsList` finishes laying out. | -| `switch_report_from_preview` | ❌ | **[REMOVED]** Time taken to open a report from preview. | Starts when the user presses the Report Preview. | Stops when the `ReportActionsList` finishes laying out. | | `open_report_thread` | ✅ | Time taken to open a thread in a report.

**Platforms:** All | Starts when user presses Report Action Item. | Stops when the `ReportActionsList` finishes laying out. | | `message_sent` | ❌ | Time taken to send a message.

**Platforms:** All | Starts when the new message is sent. | Stops when the message is being rendered in the chat. | diff --git a/src/CONST.ts b/src/CONST.ts index b1a88118ac2a..c49f92e9d1ef 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1255,7 +1255,6 @@ const CONST = { CALCULATE_MOST_RECENT_LAST_MODIFIED_ACTION: 'calc_most_recent_last_modified_action', SEARCH_ROUTER_RENDER: 'search_router_render', OPEN_REPORT: 'open_report', - SWITCH_REPORT: 'switch_report', OPEN_REPORT_FROM_PREVIEW: 'open_report_from_preview', OPEN_REPORT_THREAD: 'open_report_thread', LOAD_SEARCH_OPTIONS: 'load_search_options', diff --git a/src/libs/E2E/tests/linkingTest.e2e.ts b/src/libs/E2E/tests/linkingTest.e2e.ts index b517d91658b4..efe304a5cd12 100644 --- a/src/libs/E2E/tests/linkingTest.e2e.ts +++ b/src/libs/E2E/tests/linkingTest.e2e.ts @@ -1,13 +1,10 @@ import {DeviceEventEmitter} from 'react-native'; import type {NativeConfig} from 'react-native-config'; -import Config from 'react-native-config'; import E2ELogin from '@libs/E2E/actions/e2eLogin'; import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded'; import E2EClient from '@libs/E2E/client'; import getConfigValueOrThrow from '@libs/E2E/utils/getConfigValueOrThrow'; import getPromiseWithResolve from '@libs/E2E/utils/getPromiseWithResolve'; -import Performance from '@libs/Performance'; -import CONST from '@src/CONST'; type ViewableItem = { reportActionID?: string; @@ -19,7 +16,6 @@ const test = (config: NativeConfig) => { console.debug('[E2E] Logging in for comment linking'); const linkedReportActionID = getConfigValueOrThrow('linkedReportActionID', config); - const name = getConfigValueOrThrow('name', config); E2ELogin().then((neededLogin) => { if (neededLogin) { @@ -27,7 +23,7 @@ const test = (config: NativeConfig) => { } const [appearMessagePromise, appearMessageResolve] = getPromiseWithResolve(); - const [switchReportPromise, switchReportResolve] = getPromiseWithResolve(); + const [switchReportPromise] = getPromiseWithResolve(); Promise.all([appearMessagePromise, switchReportPromise]) .then(() => { @@ -48,21 +44,6 @@ const test = (config: NativeConfig) => { console.debug(`[E2E] Provided message id '${res?.at(0)?.item?.reportActionID}' doesn't match to an expected '${linkedReportActionID}'. Waiting for a next one…`); } }); - - Performance.subscribeToMeasurements((entry) => { - if (entry.name === CONST.TIMING.SWITCH_REPORT) { - console.debug('[E2E] Linking: 1'); - - E2EClient.submitTestResults({ - branch: Config.E2E_BRANCH, - name, - metric: entry.duration, - unit: 'ms', - }); - - switchReportResolve(); - } - }); }); }; diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx index 21a05f7567dc..c2e0fded42f5 100755 --- a/src/pages/home/report/ReportActionsView.tsx +++ b/src/pages/home/report/ReportActionsView.tsx @@ -6,7 +6,6 @@ import {InteractionManager} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import {useOnyx} from 'react-native-onyx'; import useCopySelectionHelper from '@hooks/useCopySelectionHelper'; -import useInitialValue from '@hooks/useInitialValue'; import useNetwork from '@hooks/useNetwork'; import usePrevious from '@hooks/usePrevious'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; @@ -285,7 +284,6 @@ function ReportActionsView({ const hasMoreCached = reportActions.length < combinedReportActions.length; const newestReportAction = useMemo(() => reportActions?.at(0), [reportActions]); const mostRecentIOUReportActionID = useMemo(() => ReportActionsUtils.getMostRecentIOURequestActionID(reportActions), [reportActions]); - const hasCachedActionOnFirstRender = useInitialValue(() => reportActions.length > 0); const hasNewestReportAction = reportActions.at(0)?.created === report.lastVisibleActionCreated || reportActions.at(0)?.created === transactionThreadReport?.lastVisibleActionCreated; const oldestReportAction = useMemo(() => reportActions?.at(-1), [reportActions]); @@ -427,17 +425,11 @@ function ReportActionsView({ } didLayout.current = true; - // Capture the init measurement only once not per each chat switch as the value gets overwritten - if (!ReportActionsView.initMeasured) { - Performance.markEnd(CONST.TIMING.OPEN_REPORT); - ReportActionsView.initMeasured = true; - } else { - Performance.markEnd(CONST.TIMING.SWITCH_REPORT); - } - Timing.end(CONST.TIMING.SWITCH_REPORT, hasCachedActionOnFirstRender ? CONST.TIMING.WARM : CONST.TIMING.COLD); + + Performance.markEnd(CONST.TIMING.OPEN_REPORT); Timing.end(CONST.TIMING.OPEN_REPORT_THREAD); Timing.end(CONST.TIMING.OPEN_REPORT_FROM_PREVIEW); - }, [hasCachedActionOnFirstRender]); + }, []); // Check if the first report action in the list is the one we're currently linked to const isTheFirstReportActionIsLinked = newestReportAction?.reportActionID === reportActionID; @@ -500,7 +492,6 @@ function ReportActionsView({ } ReportActionsView.displayName = 'ReportActionsView'; -ReportActionsView.initMeasured = false; function arePropsEqual(oldProps: ReportActionsViewProps, newProps: ReportActionsViewProps): boolean { if (!lodashIsEqual(oldProps.reportActions, newProps.reportActions)) { diff --git a/src/pages/home/sidebar/SidebarLinks.tsx b/src/pages/home/sidebar/SidebarLinks.tsx index e62f2525e70b..e2df0ff6f33a 100644 --- a/src/pages/home/sidebar/SidebarLinks.tsx +++ b/src/pages/home/sidebar/SidebarLinks.tsx @@ -17,9 +17,6 @@ import ROUTES from '@src/ROUTES'; import type {Report} from '@src/types/onyx'; type SidebarLinksProps = { - /** Toggles the navigation menu open and closed */ - onLinkClick: () => void; - /** Safe area insets required for mobile devices margins */ insets: EdgeInsets; @@ -40,7 +37,7 @@ type SidebarLinksProps = { activeWorkspaceID: string | undefined; }; -function SidebarLinks({onLinkClick, insets, optionListItems, isLoading, priorityMode = CONST.PRIORITY_MODE.DEFAULT, isActiveReport}: SidebarLinksProps) { +function SidebarLinks({insets, optionListItems, isLoading, priorityMode = CONST.PRIORITY_MODE.DEFAULT, isActiveReport}: SidebarLinksProps) { const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); const {updateLocale} = useLocalize(); @@ -75,9 +72,8 @@ function SidebarLinks({onLinkClick, insets, optionListItems, isLoading, priority return; } Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(option.reportID)); - onLinkClick(); }, - [shouldUseNarrowLayout, isActiveReport, onLinkClick], + [shouldUseNarrowLayout, isActiveReport], ); const viewMode = priorityMode === CONST.PRIORITY_MODE.GSD ? CONST.OPTION_MODE.COMPACT : CONST.OPTION_MODE.DEFAULT; diff --git a/src/pages/home/sidebar/SidebarLinksData.tsx b/src/pages/home/sidebar/SidebarLinksData.tsx index 7dfbdbaf7299..931bfd6c0d66 100644 --- a/src/pages/home/sidebar/SidebarLinksData.tsx +++ b/src/pages/home/sidebar/SidebarLinksData.tsx @@ -24,14 +24,11 @@ type SidebarLinksDataOnyxProps = { }; type SidebarLinksDataProps = SidebarLinksDataOnyxProps & { - /** Toggles the navigation menu open and closed */ - onLinkClick: () => void; - /** Safe area insets required for mobile devices margins */ insets: EdgeInsets; }; -function SidebarLinksData({insets, isLoadingApp = true, onLinkClick, priorityMode = CONST.PRIORITY_MODE.DEFAULT}: SidebarLinksDataProps) { +function SidebarLinksData({insets, isLoadingApp = true, priorityMode = CONST.PRIORITY_MODE.DEFAULT}: SidebarLinksDataProps) { const isFocused = useIsFocused(); const styles = useThemeStyles(); const activeWorkspaceID = useActiveWorkspaceFromNavigationState(); @@ -63,7 +60,6 @@ function SidebarLinksData({insets, isLoadingApp = true, onLinkClick, priorityMod > ({ initialValue: CONST.PRIORITY_MODE.DEFAULT, }, })( - /* + /* While working on audit on the App Start App metric we noticed that by memoizing SidebarLinksData we can avoid 2 additional run of getOrderedReportIDs. With that we can reduce app start up time by ~2s on heavy account. More details - https://github.com/Expensify/App/issues/35234#issuecomment-1926914534 */ memo( SidebarLinksData, - (prevProps, nextProps) => - prevProps.isLoadingApp === nextProps.isLoadingApp && - prevProps.priorityMode === nextProps.priorityMode && - lodashIsEqual(prevProps.insets, nextProps.insets) && - prevProps.onLinkClick === nextProps.onLinkClick, + (prevProps, nextProps) => prevProps.isLoadingApp === nextProps.isLoadingApp && prevProps.priorityMode === nextProps.priorityMode && lodashIsEqual(prevProps.insets, nextProps.insets), ), ); diff --git a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx index 3421d72270fc..93a608f2df22 100644 --- a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx +++ b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx @@ -10,20 +10,9 @@ import {updateLastAccessedWorkspace} from '@libs/actions/Policy/Policy'; import * as Browser from '@libs/Browser'; import TopBar from '@libs/Navigation/AppNavigator/createCustomBottomTabNavigator/TopBar'; import Navigation from '@libs/Navigation/Navigation'; -import Performance from '@libs/Performance'; import SidebarLinksData from '@pages/home/sidebar/SidebarLinksData'; -import Timing from '@userActions/Timing'; -import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -/** - * Function called when a pinned chat is selected. - */ -const startTimer = () => { - Timing.start(CONST.TIMING.SWITCH_REPORT); - Performance.markStart(CONST.TIMING.SWITCH_REPORT); -}; - function BaseSidebarScreen() { const styles = useThemeStyles(); const activeWorkspaceID = useActiveWorkspaceFromNavigationState(); @@ -58,10 +47,7 @@ function BaseSidebarScreen() { shouldDisplaySearch={shouldDisplaySearch} /> - + )} diff --git a/tests/utils/LHNTestUtils.tsx b/tests/utils/LHNTestUtils.tsx index ae9afd095d37..6fb767cfb3e3 100644 --- a/tests/utils/LHNTestUtils.tsx +++ b/tests/utils/LHNTestUtils.tsx @@ -251,7 +251,6 @@ function MockedSidebarLinks({currentReportID = ''}: MockedSidebarLinksProps) { * */} {}} insets={{ top: 0, left: 0, From 6f0eabb1f91a8a3767670f83d6f9629bce900cde Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Thu, 31 Oct 2024 17:51:29 +0100 Subject: [PATCH 06/22] feat: start remote tracking the message_sent event --- contributingGuides/PERFORMANCE_METRICS.md | 2 +- .../home/report/ReportActionCompose/ReportActionCompose.tsx | 2 ++ src/pages/home/report/comment/TextCommentFragment.tsx | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/contributingGuides/PERFORMANCE_METRICS.md b/contributingGuides/PERFORMANCE_METRICS.md index 36ffc6ee3b8d..89e7d10cee66 100644 --- a/contributingGuides/PERFORMANCE_METRICS.md +++ b/contributingGuides/PERFORMANCE_METRICS.md @@ -22,7 +22,7 @@ Project is using Firebase for tracking these metrics. However, not all of them a | `open_report` | ❌ | Time taken to open a report.

**Platforms:** All | Starts when the row in the `LHNOptionsList` is pressed. | Stops when the `ReportActionsList` finishes laying out. | | `open_report_from_preview` | ✅ | Time taken to open a report from preview.

(previously `switch_report_from_preview`)

**Platforms:** All | Starts when the user presses the Report Preview. | Stops when the `ReportActionsList` finishes laying out. | | `open_report_thread` | ✅ | Time taken to open a thread in a report.

**Platforms:** All | Starts when user presses Report Action Item. | Stops when the `ReportActionsList` finishes laying out. | -| `message_sent` | ❌ | Time taken to send a message.

**Platforms:** All | Starts when the new message is sent. | Stops when the message is being rendered in the chat. | +| `message_sent` | ✅ | Time taken to send a message.

**Platforms:** All | Starts when the new message is sent. | Stops when the message is being rendered in the chat. | ## Documentation Maintenance diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx index 23b059f2fda2..8a6b88b8c25c 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx @@ -43,6 +43,7 @@ import ReportTypingIndicator from '@pages/home/report/ReportTypingIndicator'; import variables from '@styles/variables'; import * as EmojiPickerActions from '@userActions/EmojiPickerAction'; import * as Report from '@userActions/Report'; +import Timing from '@userActions/Timing'; import * as User from '@userActions/User'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -274,6 +275,7 @@ function ReportActionCompose({ attachmentFileRef.current = null; } else { Performance.markStart(CONST.TIMING.MESSAGE_SENT, {message: newCommentTrimmed}); + Timing.start(CONST.TIMING.MESSAGE_SENT); onSubmit(newCommentTrimmed); } }, diff --git a/src/pages/home/report/comment/TextCommentFragment.tsx b/src/pages/home/report/comment/TextCommentFragment.tsx index 530acc46233d..94c8f46845c6 100644 --- a/src/pages/home/report/comment/TextCommentFragment.tsx +++ b/src/pages/home/report/comment/TextCommentFragment.tsx @@ -14,6 +14,7 @@ import * as EmojiUtils from '@libs/EmojiUtils'; import Performance from '@libs/Performance'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import variables from '@styles/variables'; +import Timing from '@userActions/Timing'; import CONST from '@src/CONST'; import type {OriginalMessageSource} from '@src/types/onyx/OriginalMessage'; import type {Message} from '@src/types/onyx/ReportAction'; @@ -53,6 +54,7 @@ function TextCommentFragment({fragment, styleAsDeleted, styleAsMuted = false, so useEffect(() => { Performance.markEnd(CONST.TIMING.MESSAGE_SENT, {message: text}); + Timing.end(CONST.TIMING.MESSAGE_SENT); }, [text]); // If the only difference between fragment.text and fragment.html is
tags and emoji tag From e09796c9694213a4ba98f2e63de0be0dd598041e Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Thu, 31 Oct 2024 17:54:30 +0100 Subject: [PATCH 07/22] feat: start remote tracking the open_report event --- contributingGuides/PERFORMANCE_METRICS.md | 2 +- src/components/LHNOptionsList/OptionRowLHN.tsx | 2 ++ src/pages/home/report/ReportActionsView.tsx | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/contributingGuides/PERFORMANCE_METRICS.md b/contributingGuides/PERFORMANCE_METRICS.md index 89e7d10cee66..c7af6bae0223 100644 --- a/contributingGuides/PERFORMANCE_METRICS.md +++ b/contributingGuides/PERFORMANCE_METRICS.md @@ -19,7 +19,7 @@ Project is using Firebase for tracking these metrics. However, not all of them a | `load_search_options` | ✅ | Time taken to generate the list of options used in Chat Finder.

**Platforms:** All | Starts when the `getSearchOptions` function is called. | Stops when the list of available options is generated. | | `search_filter_options` | ✅ | Time taken to filter search options in Chat Finder by given search value.

**Platforms:** All | Starts when user types something in the Chat Finder search input. | Stops when the list of filtered options is generated. | | `trie_initialization` | ✅ | Time taken to build the emoji trie.

**Platforms:** All | Starts when emoji trie begins to build. | Stops when emoji trie building is complete. | -| `open_report` | ❌ | Time taken to open a report.

**Platforms:** All | Starts when the row in the `LHNOptionsList` is pressed. | Stops when the `ReportActionsList` finishes laying out. | +| `open_report` | ✅ | Time taken to open a report.

**Platforms:** All | Starts when the row in the `LHNOptionsList` is pressed. | Stops when the `ReportActionsList` finishes laying out. | | `open_report_from_preview` | ✅ | Time taken to open a report from preview.

(previously `switch_report_from_preview`)

**Platforms:** All | Starts when the user presses the Report Preview. | Stops when the `ReportActionsList` finishes laying out. | | `open_report_thread` | ✅ | Time taken to open a thread in a report.

**Platforms:** All | Starts when user presses Report Action Item. | Stops when the `ReportActionsList` finishes laying out. | | `message_sent` | ✅ | Time taken to send a message.

**Platforms:** All | Starts when the new message is sent. | Stops when the message is being rendered in the chat. | diff --git a/src/components/LHNOptionsList/OptionRowLHN.tsx b/src/components/LHNOptionsList/OptionRowLHN.tsx index 94116181bccb..3e3f4d1b8e5d 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.tsx +++ b/src/components/LHNOptionsList/OptionRowLHN.tsx @@ -30,6 +30,7 @@ import * as ReportUtils from '@libs/ReportUtils'; import * as ReportActionContextMenu from '@pages/home/report/ContextMenu/ReportActionContextMenu'; import FreeTrial from '@pages/settings/Subscription/FreeTrial'; import variables from '@styles/variables'; +import Timing from '@userActions/Timing'; import * as User from '@userActions/User'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -193,6 +194,7 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti ref={popoverAnchor} onPress={(event) => { Performance.markStart(CONST.TIMING.OPEN_REPORT); + Timing.start(CONST.TIMING.OPEN_REPORT); event?.preventDefault(); // Enable Composer to focus on clicking the same chat after opening the context menu. diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx index c2e0fded42f5..7b515c060205 100755 --- a/src/pages/home/report/ReportActionsView.tsx +++ b/src/pages/home/report/ReportActionsView.tsx @@ -427,6 +427,7 @@ function ReportActionsView({ didLayout.current = true; Performance.markEnd(CONST.TIMING.OPEN_REPORT); + Timing.end(CONST.TIMING.OPEN_REPORT); Timing.end(CONST.TIMING.OPEN_REPORT_THREAD); Timing.end(CONST.TIMING.OPEN_REPORT_FROM_PREVIEW); }, []); From 5f27a44d56dca7843ac216dfe0576ef5d69b6bde Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Mon, 4 Nov 2024 14:17:32 +0100 Subject: [PATCH 08/22] feat: update docs & impl for the open_search event --- contributingGuides/PERFORMANCE_METRICS.md | 2 +- src/CONST.ts | 2 +- src/components/Search/SearchRouter/SearchButton.tsx | 4 ++-- src/components/Search/SearchRouter/SearchRouterList.tsx | 4 ++-- src/libs/E2E/tests/openSearchRouterTest.e2e.ts | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contributingGuides/PERFORMANCE_METRICS.md b/contributingGuides/PERFORMANCE_METRICS.md index c7af6bae0223..6c72d08a65c0 100644 --- a/contributingGuides/PERFORMANCE_METRICS.md +++ b/contributingGuides/PERFORMANCE_METRICS.md @@ -15,7 +15,7 @@ Project is using Firebase for tracking these metrics. However, not all of them a | `_app_in_foreground` | ✅ | The time when the app is running in the foreground and available to the user.

**Platforms:** Android, iOS | **Android:** Starts when the first activity to reach the foreground has its `onResume()` method called.

**iOS:** Starts when the application receives the `UIApplicationDidBecomeActiveNotification` notification. | **Android:** Stops when the last activity to leave the foreground has its `onStop()` method called.

**iOS:** Stops when it receives the `UIApplicationWillResignActiveNotification` notification. | | `_app_in_background` | ✅ | Time when the app is running in the background.

**Platforms:** Android, iOS | **Android:** Starts when the last activity to leave the foreground has its `onStop()` method called.

**iOS:** Starts when the application receives the `UIApplicationWillResignActiveNotification` notification. | **Android:** Stops when the first activity to reach the foreground has its `onResume()` method called.

**iOS:** Stops when it receives the `UIApplicationDidBecomeActiveNotification` notification. | | `calc_most_recent_last_modified_action` | ✅ | Time taken to find the most recently modified report action or report.

**Platforms:** All | Starts when the app reconnects to the network | Ends when the app reconnects to the network and the most recent report action or report is found. | -| `search_render` | ✅ | Time taken to render the Chat Finder page.

**Platforms:** All | Starts when the Chat Finder icon in LHN is pressed. | Stops when the list of available options is rendered for the first time. | +| `open_search` | ✅ | Time taken to open up the Search Router.

**Platforms:** All | Starts when the Search Router icon in LHN is pressed. | Stops when the list of available options finishes laying out. | | `load_search_options` | ✅ | Time taken to generate the list of options used in Chat Finder.

**Platforms:** All | Starts when the `getSearchOptions` function is called. | Stops when the list of available options is generated. | | `search_filter_options` | ✅ | Time taken to filter search options in Chat Finder by given search value.

**Platforms:** All | Starts when user types something in the Chat Finder search input. | Stops when the list of filtered options is generated. | | `trie_initialization` | ✅ | Time taken to build the emoji trie.

**Platforms:** All | Starts when emoji trie begins to build. | Stops when emoji trie building is complete. | diff --git a/src/CONST.ts b/src/CONST.ts index c49f92e9d1ef..7694e0a91488 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1253,7 +1253,7 @@ const CONST = { }, TIMING: { CALCULATE_MOST_RECENT_LAST_MODIFIED_ACTION: 'calc_most_recent_last_modified_action', - SEARCH_ROUTER_RENDER: 'search_router_render', + OPEN_SEARCH: 'open_search', OPEN_REPORT: 'open_report', OPEN_REPORT_FROM_PREVIEW: 'open_report_from_preview', OPEN_REPORT_THREAD: 'open_report_thread', diff --git a/src/components/Search/SearchRouter/SearchButton.tsx b/src/components/Search/SearchRouter/SearchButton.tsx index 76eacd8b991d..90699e951998 100644 --- a/src/components/Search/SearchRouter/SearchButton.tsx +++ b/src/components/Search/SearchRouter/SearchButton.tsx @@ -30,8 +30,8 @@ function SearchButton({style}: SearchButtonProps) { accessibilityLabel={translate('common.search')} style={[styles.flexRow, styles.touchableButtonImage, style]} onPress={Session.checkIfActionIsAllowed(() => { - Timing.start(CONST.TIMING.SEARCH_ROUTER_RENDER); - Performance.markStart(CONST.TIMING.SEARCH_ROUTER_RENDER); + Timing.start(CONST.TIMING.OPEN_SEARCH); + Performance.markStart(CONST.TIMING.OPEN_SEARCH); openSearchRouter(); })} diff --git a/src/components/Search/SearchRouter/SearchRouterList.tsx b/src/components/Search/SearchRouter/SearchRouterList.tsx index cc854ff926c3..45e30a6bad6d 100644 --- a/src/components/Search/SearchRouter/SearchRouterList.tsx +++ b/src/components/Search/SearchRouter/SearchRouterList.tsx @@ -69,8 +69,8 @@ type SearchRouterListProps = { }; const setPerformanceTimersEnd = () => { - Timing.end(CONST.TIMING.SEARCH_ROUTER_RENDER); - Performance.markEnd(CONST.TIMING.SEARCH_ROUTER_RENDER); + Timing.end(CONST.TIMING.OPEN_SEARCH); + Performance.markEnd(CONST.TIMING.OPEN_SEARCH); }; function getContextualSearchQuery(reportName: string) { diff --git a/src/libs/E2E/tests/openSearchRouterTest.e2e.ts b/src/libs/E2E/tests/openSearchRouterTest.e2e.ts index f3741f2e2b53..d1fd27b9bac7 100644 --- a/src/libs/E2E/tests/openSearchRouterTest.e2e.ts +++ b/src/libs/E2E/tests/openSearchRouterTest.e2e.ts @@ -36,7 +36,7 @@ const test = (config: NativeConfig) => { Performance.subscribeToMeasurements((entry) => { console.debug(`[E2E] Entry: ${JSON.stringify(entry)}`); - if (entry.name === CONST.TIMING.SEARCH_ROUTER_RENDER) { + if (entry.name === CONST.TIMING.OPEN_SEARCH) { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, name: `${name} Open Search Router TTI`, From c7a661a54112aed48d2effff270f02c0d86780e4 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Mon, 4 Nov 2024 14:24:01 +0100 Subject: [PATCH 09/22] docs: update descriptions for the search_filter_options and load_filter_options events --- contributingGuides/PERFORMANCE_METRICS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contributingGuides/PERFORMANCE_METRICS.md b/contributingGuides/PERFORMANCE_METRICS.md index 6c72d08a65c0..d45b7c2e625c 100644 --- a/contributingGuides/PERFORMANCE_METRICS.md +++ b/contributingGuides/PERFORMANCE_METRICS.md @@ -16,8 +16,8 @@ Project is using Firebase for tracking these metrics. However, not all of them a | `_app_in_background` | ✅ | Time when the app is running in the background.

**Platforms:** Android, iOS | **Android:** Starts when the last activity to leave the foreground has its `onStop()` method called.

**iOS:** Starts when the application receives the `UIApplicationWillResignActiveNotification` notification. | **Android:** Stops when the first activity to reach the foreground has its `onResume()` method called.

**iOS:** Stops when it receives the `UIApplicationDidBecomeActiveNotification` notification. | | `calc_most_recent_last_modified_action` | ✅ | Time taken to find the most recently modified report action or report.

**Platforms:** All | Starts when the app reconnects to the network | Ends when the app reconnects to the network and the most recent report action or report is found. | | `open_search` | ✅ | Time taken to open up the Search Router.

**Platforms:** All | Starts when the Search Router icon in LHN is pressed. | Stops when the list of available options finishes laying out. | -| `load_search_options` | ✅ | Time taken to generate the list of options used in Chat Finder.

**Platforms:** All | Starts when the `getSearchOptions` function is called. | Stops when the list of available options is generated. | -| `search_filter_options` | ✅ | Time taken to filter search options in Chat Finder by given search value.

**Platforms:** All | Starts when user types something in the Chat Finder search input. | Stops when the list of filtered options is generated. | +| `load_search_options` | ✅ | Time taken to generate the list of options used in the Search Router.

**Platforms:** All | Starts when the `getSearchOptions` function is called. | Stops when the list of available options is generated. | +| `search_filter_options` | ✅ | Time taken to filter search options in the Search Router by the given search value.

**Platforms:** All | Starts when user types something in the Search Router search input. | Stops when the list of filtered options is generated. | | `trie_initialization` | ✅ | Time taken to build the emoji trie.

**Platforms:** All | Starts when emoji trie begins to build. | Stops when emoji trie building is complete. | | `open_report` | ✅ | Time taken to open a report.

**Platforms:** All | Starts when the row in the `LHNOptionsList` is pressed. | Stops when the `ReportActionsList` finishes laying out. | | `open_report_from_preview` | ✅ | Time taken to open a report from preview.

(previously `switch_report_from_preview`)

**Platforms:** All | Starts when the user presses the Report Preview. | Stops when the `ReportActionsList` finishes laying out. | From c1a0d42642381b4cd19eb4a43d2ce024cffd7549 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Tue, 5 Nov 2024 15:31:29 +0100 Subject: [PATCH 10/22] Revert "chore: remove the sidebar_loaded event" This reverts commit f50765a6c83b37b1477f7d9edbe232e52792783c. --- contributingGuides/PERFORMANCE_METRICS.md | 1 + src/CONST.ts | 1 + src/Expensify.tsx | 1 + src/libs/E2E/tests/chatOpeningTest.e2e.ts | 10 ++++++++ src/libs/E2E/tests/linkingTest.e2e.ts | 13 ++++++++++ .../E2E/tests/openSearchRouterTest.e2e.ts | 24 +++++++++++++++++++ src/libs/E2E/tests/reportTypingTest.e2e.ts | 4 ++++ src/libs/Performance.tsx | 4 ++++ .../SidebarScreen/BaseSidebarScreen.tsx | 5 ++++ 9 files changed, 63 insertions(+) diff --git a/contributingGuides/PERFORMANCE_METRICS.md b/contributingGuides/PERFORMANCE_METRICS.md index d45b7c2e625c..4412de96a472 100644 --- a/contributingGuides/PERFORMANCE_METRICS.md +++ b/contributingGuides/PERFORMANCE_METRICS.md @@ -14,6 +14,7 @@ Project is using Firebase for tracking these metrics. However, not all of them a | `js_loaded` | ✅ | The time it takes for the JavaScript bundle to load.

**Platforms:** Android, iOS | **Android:** Starts in the `onCreate` method.

**iOS:** Starts in the AppDelegate's `didFinishLaunchingWithOptions` method. | Stops at the first render of the app via native module on the JS side. | | `_app_in_foreground` | ✅ | The time when the app is running in the foreground and available to the user.

**Platforms:** Android, iOS | **Android:** Starts when the first activity to reach the foreground has its `onResume()` method called.

**iOS:** Starts when the application receives the `UIApplicationDidBecomeActiveNotification` notification. | **Android:** Stops when the last activity to leave the foreground has its `onStop()` method called.

**iOS:** Stops when it receives the `UIApplicationWillResignActiveNotification` notification. | | `_app_in_background` | ✅ | Time when the app is running in the background.

**Platforms:** Android, iOS | **Android:** Starts when the last activity to leave the foreground has its `onStop()` method called.

**iOS:** Starts when the application receives the `UIApplicationWillResignActiveNotification` notification. | **Android:** Stops when the first activity to reach the foreground has its `onResume()` method called.

**iOS:** Stops when it receives the `UIApplicationDidBecomeActiveNotification` notification. | +| `sidebar_loaded` | ❌ | Time taken for the Sidebar to load.

**Platforms:** All | Starts when the Sidebar is mounted. | Stops when the Splash Screen is hidden. | | `calc_most_recent_last_modified_action` | ✅ | Time taken to find the most recently modified report action or report.

**Platforms:** All | Starts when the app reconnects to the network | Ends when the app reconnects to the network and the most recent report action or report is found. | | `open_search` | ✅ | Time taken to open up the Search Router.

**Platforms:** All | Starts when the Search Router icon in LHN is pressed. | Stops when the list of available options finishes laying out. | | `load_search_options` | ✅ | Time taken to generate the list of options used in the Search Router.

**Platforms:** All | Starts when the `getSearchOptions` function is called. | Stops when the list of available options is generated. | diff --git a/src/CONST.ts b/src/CONST.ts index 7694e0a91488..2fdef3e7a3d0 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1257,6 +1257,7 @@ const CONST = { OPEN_REPORT: 'open_report', OPEN_REPORT_FROM_PREVIEW: 'open_report_from_preview', OPEN_REPORT_THREAD: 'open_report_thread', + SIDEBAR_LOADED: 'sidebar_loaded', LOAD_SEARCH_OPTIONS: 'load_search_options', MESSAGE_SENT: 'message_sent', COLD: 'cold', diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 40e937af2d1b..e07b03a6d405 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -138,6 +138,7 @@ function Expensify() { const onSplashHide = useCallback(() => { setSplashScreenState(CONST.BOOT_SPLASH_STATE.HIDDEN); + Performance.markEnd(CONST.TIMING.SIDEBAR_LOADED); }, [setSplashScreenState]); useLayoutEffect(() => { diff --git a/src/libs/E2E/tests/chatOpeningTest.e2e.ts b/src/libs/E2E/tests/chatOpeningTest.e2e.ts index f7ec35018028..40e5d2677090 100644 --- a/src/libs/E2E/tests/chatOpeningTest.e2e.ts +++ b/src/libs/E2E/tests/chatOpeningTest.e2e.ts @@ -5,13 +5,16 @@ import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded'; import E2EClient from '@libs/E2E/client'; import getConfigValueOrThrow from '@libs/E2E/utils/getConfigValueOrThrow'; import getPromiseWithResolve from '@libs/E2E/utils/getPromiseWithResolve'; +import Navigation from '@libs/Navigation/Navigation'; import Performance from '@libs/Performance'; import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; const test = (config: NativeConfig) => { // check for login (if already logged in the action will simply resolve) console.debug('[E2E] Logging in for chat opening'); + const reportID = getConfigValueOrThrow('reportID', config); const name = getConfigValueOrThrow('name', config); E2ELogin().then((neededLogin) => { @@ -34,6 +37,13 @@ const test = (config: NativeConfig) => { }); Performance.subscribeToMeasurements((entry) => { + if (entry.name === CONST.TIMING.SIDEBAR_LOADED) { + console.debug(`[E2E] Sidebar loaded, navigating to report…`); + Performance.markStart(CONST.TIMING.OPEN_REPORT); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); + return; + } + console.debug(`[E2E] Entry: ${JSON.stringify(entry)}`); if (entry.name === CONST.TIMING.OPEN_REPORT) { diff --git a/src/libs/E2E/tests/linkingTest.e2e.ts b/src/libs/E2E/tests/linkingTest.e2e.ts index efe304a5cd12..00238858dc54 100644 --- a/src/libs/E2E/tests/linkingTest.e2e.ts +++ b/src/libs/E2E/tests/linkingTest.e2e.ts @@ -5,6 +5,10 @@ import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded'; import E2EClient from '@libs/E2E/client'; import getConfigValueOrThrow from '@libs/E2E/utils/getConfigValueOrThrow'; import getPromiseWithResolve from '@libs/E2E/utils/getPromiseWithResolve'; +import Navigation from '@libs/Navigation/Navigation'; +import Performance from '@libs/Performance'; +import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; type ViewableItem = { reportActionID?: string; @@ -15,6 +19,7 @@ type ViewableItemResponse = Array<{item?: ViewableItem}>; const test = (config: NativeConfig) => { console.debug('[E2E] Logging in for comment linking'); + const reportID = getConfigValueOrThrow('reportID', config); const linkedReportActionID = getConfigValueOrThrow('linkedReportActionID', config); E2ELogin().then((neededLogin) => { @@ -44,6 +49,14 @@ const test = (config: NativeConfig) => { console.debug(`[E2E] Provided message id '${res?.at(0)?.item?.reportActionID}' doesn't match to an expected '${linkedReportActionID}'. Waiting for a next one…`); } }); + + Performance.subscribeToMeasurements((entry) => { + if (entry.name === CONST.TIMING.SIDEBAR_LOADED) { + console.debug('[E2E] Sidebar loaded, navigating to a report…'); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); + return; + } + }); }); }; diff --git a/src/libs/E2E/tests/openSearchRouterTest.e2e.ts b/src/libs/E2E/tests/openSearchRouterTest.e2e.ts index d1fd27b9bac7..4fd2b26e63c8 100644 --- a/src/libs/E2E/tests/openSearchRouterTest.e2e.ts +++ b/src/libs/E2E/tests/openSearchRouterTest.e2e.ts @@ -1,5 +1,6 @@ import Config from 'react-native-config'; import type {NativeConfig} from 'react-native-config'; +import * as E2EGenericPressableWrapper from '@components/Pressable/GenericPressable/index.e2e'; import E2ELogin from '@libs/E2E/actions/e2eLogin'; import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded'; import E2EClient from '@libs/E2E/client'; @@ -35,6 +36,29 @@ const test = (config: NativeConfig) => { Performance.subscribeToMeasurements((entry) => { console.debug(`[E2E] Entry: ${JSON.stringify(entry)}`); + if (entry.name === CONST.TIMING.SIDEBAR_LOADED) { + const props = E2EGenericPressableWrapper.getPressableProps('searchButton'); + if (!props) { + console.debug('[E2E] Search button not found, failing test!'); + E2EClient.submitTestResults({ + branch: Config.E2E_BRANCH, + error: 'Search button not found', + name: `${name} Open Search Router TTI`, + }).then(() => E2EClient.submitTestDone()); + return; + } + if (!props.onPress) { + console.debug('[E2E] Search button found but onPress prop was not present, failing test!'); + E2EClient.submitTestResults({ + branch: Config.E2E_BRANCH, + error: 'Search button found but onPress prop was not present', + name: `${name} Open Search Router TTI`, + }).then(() => E2EClient.submitTestDone()); + return; + } + // Open the search router + props.onPress(); + } if (entry.name === CONST.TIMING.OPEN_SEARCH) { E2EClient.submitTestResults({ diff --git a/src/libs/E2E/tests/reportTypingTest.e2e.ts b/src/libs/E2E/tests/reportTypingTest.e2e.ts index f25859194541..e042a688c37d 100644 --- a/src/libs/E2E/tests/reportTypingTest.e2e.ts +++ b/src/libs/E2E/tests/reportTypingTest.e2e.ts @@ -53,6 +53,10 @@ const test = (config: NativeConfig) => { return; } + if (entry.name !== CONST.TIMING.SIDEBAR_LOADED) { + return; + } + console.debug(`[E2E] Sidebar loaded, navigating to a report…`); // Crowded Policy (Do Not Delete) Report, has a input bar available: Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); diff --git a/src/libs/Performance.tsx b/src/libs/Performance.tsx index 6d9319276f9a..ef2b08e47229 100644 --- a/src/libs/Performance.tsx +++ b/src/libs/Performance.tsx @@ -160,6 +160,10 @@ if (Metrics.canCapturePerformanceMetrics()) { } // Capture any custom measures or metrics below + if (mark.name === `${CONST.TIMING.SIDEBAR_LOADED}_end`) { + Performance.measureFailSafe('contentAppeared_To_screenTTI', 'contentAppeared', mark.name); + Performance.measureTTI(mark.name); + } }); }).observe({type: 'mark', buffered: true}); }; diff --git a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx index 93a608f2df22..6f8b2b71fe53 100644 --- a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx +++ b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx @@ -20,6 +20,11 @@ function BaseSidebarScreen() { const {shouldUseNarrowLayout} = useResponsiveLayout(); const [activeWorkspace] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activeWorkspaceID ?? -1}`); + useEffect(() => { + Performance.markStart(CONST.TIMING.SIDEBAR_LOADED); + Timing.start(CONST.TIMING.SIDEBAR_LOADED); + }, []); + useEffect(() => { if (!!activeWorkspace || activeWorkspaceID === undefined) { return; From 0d3cf61fa7777df1b832f415f5f2655e5fb7d8c8 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Tue, 5 Nov 2024 15:35:10 +0100 Subject: [PATCH 11/22] fix: imports --- src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx index 6f8b2b71fe53..0dcb1124ee3e 100644 --- a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx +++ b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx @@ -10,7 +10,10 @@ import {updateLastAccessedWorkspace} from '@libs/actions/Policy/Policy'; import * as Browser from '@libs/Browser'; import TopBar from '@libs/Navigation/AppNavigator/createCustomBottomTabNavigator/TopBar'; import Navigation from '@libs/Navigation/Navigation'; +import Performance from '@libs/Performance'; import SidebarLinksData from '@pages/home/sidebar/SidebarLinksData'; +import Timing from '@userActions/Timing'; +import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; function BaseSidebarScreen() { From 2e7f51aac66347ddc9ddf9e331cfb4fd9fc0ceee Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Tue, 5 Nov 2024 15:57:29 +0100 Subject: [PATCH 12/22] chore: clear imports linter checks --- src/libs/actions/App.ts | 1 - src/pages/home/ReportScreen.tsx | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/libs/actions/App.ts b/src/libs/actions/App.ts index 7fe1745285fb..f304c4522796 100644 --- a/src/libs/actions/App.ts +++ b/src/libs/actions/App.ts @@ -14,7 +14,6 @@ import {buildEmojisTrie} from '@libs/EmojiTrie'; import Log from '@libs/Log'; import getCurrentUrl from '@libs/Navigation/currentUrl'; import Navigation from '@libs/Navigation/Navigation'; -import Performance from '@libs/Performance'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as SessionUtils from '@libs/SessionUtils'; import {clearSoundAssetsCache} from '@libs/Sound'; diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index cbc5b72730b5..62fd04f7572a 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -29,11 +29,9 @@ import usePrevious from '@hooks/usePrevious'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import useViewportOffsetTop from '@hooks/useViewportOffsetTop'; -import Timing from '@libs/actions/Timing'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; import clearReportNotifications from '@libs/Notification/clearReportNotifications'; -import Performance from '@libs/Performance'; import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; From 8c3da544b42a49a88a6d74601fa7757f1c11692d Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Tue, 5 Nov 2024 16:01:07 +0100 Subject: [PATCH 13/22] chore: rm redundant promise unwrap for removed chat_render --- src/libs/E2E/tests/chatOpeningTest.e2e.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libs/E2E/tests/chatOpeningTest.e2e.ts b/src/libs/E2E/tests/chatOpeningTest.e2e.ts index 40e5d2677090..62a01e43755d 100644 --- a/src/libs/E2E/tests/chatOpeningTest.e2e.ts +++ b/src/libs/E2E/tests/chatOpeningTest.e2e.ts @@ -27,10 +27,9 @@ const test = (config: NativeConfig) => { console.debug('[E2E] Logged in, getting chat opening metrics and submitting them…'); - const [renderChatPromise] = getPromiseWithResolve(); const [chatTTIPromise, chatTTIResolve] = getPromiseWithResolve(); - Promise.all([renderChatPromise, chatTTIPromise]).then(() => { + chatTTIPromise.then(() => { console.debug(`[E2E] Submitting!`); E2EClient.submitTestDone(); From ee03b3dfee9cc40bbdfff14ec8954ff4d86afea9 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Tue, 5 Nov 2024 16:38:02 +0100 Subject: [PATCH 14/22] fix: linking test for chats --- src/libs/E2E/tests/linkingTest.e2e.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/libs/E2E/tests/linkingTest.e2e.ts b/src/libs/E2E/tests/linkingTest.e2e.ts index 00238858dc54..f9c4b5ae33b4 100644 --- a/src/libs/E2E/tests/linkingTest.e2e.ts +++ b/src/libs/E2E/tests/linkingTest.e2e.ts @@ -1,4 +1,5 @@ import {DeviceEventEmitter} from 'react-native'; +import Config from 'react-native-config'; import type {NativeConfig} from 'react-native-config'; import E2ELogin from '@libs/E2E/actions/e2eLogin'; import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded'; @@ -21,6 +22,7 @@ const test = (config: NativeConfig) => { const reportID = getConfigValueOrThrow('reportID', config); const linkedReportActionID = getConfigValueOrThrow('linkedReportActionID', config); + const name = getConfigValueOrThrow('name', config); E2ELogin().then((neededLogin) => { if (neededLogin) { @@ -28,9 +30,9 @@ const test = (config: NativeConfig) => { } const [appearMessagePromise, appearMessageResolve] = getPromiseWithResolve(); - const [switchReportPromise] = getPromiseWithResolve(); + const [openReportPromise, openReportResolve] = getPromiseWithResolve(); - Promise.all([appearMessagePromise, switchReportPromise]) + Promise.all([appearMessagePromise, openReportPromise]) .then(() => { console.debug('[E2E] Test completed successfully, exiting…'); E2EClient.submitTestDone(); @@ -56,6 +58,18 @@ const test = (config: NativeConfig) => { Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); return; } + + if (entry.name === CONST.TIMING.OPEN_REPORT) { + console.debug('[E2E] Linking: 1'); + + E2EClient.submitTestResults({ + branch: Config.E2E_BRANCH, + name, + metric: entry.duration, + unit: 'ms', + }); + openReportResolve(); + } }); }); }; From 903f2c430b37615ae97d2cf83396c3f46e59b36d Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Tue, 5 Nov 2024 16:45:12 +0100 Subject: [PATCH 15/22] chore: empty line --- src/libs/E2E/tests/linkingTest.e2e.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/E2E/tests/linkingTest.e2e.ts b/src/libs/E2E/tests/linkingTest.e2e.ts index f9c4b5ae33b4..6488d0c8bc70 100644 --- a/src/libs/E2E/tests/linkingTest.e2e.ts +++ b/src/libs/E2E/tests/linkingTest.e2e.ts @@ -68,6 +68,7 @@ const test = (config: NativeConfig) => { metric: entry.duration, unit: 'ms', }); + openReportResolve(); } }); From 82d58be7468147d0f3c6698ece42689b0f9ebd92 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Tue, 5 Nov 2024 17:44:29 +0100 Subject: [PATCH 16/22] feat: do not start the sidebar_loaded event --- src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx index 0dcb1124ee3e..b3812ca4a9cb 100644 --- a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx +++ b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx @@ -25,7 +25,6 @@ function BaseSidebarScreen() { useEffect(() => { Performance.markStart(CONST.TIMING.SIDEBAR_LOADED); - Timing.start(CONST.TIMING.SIDEBAR_LOADED); }, []); useEffect(() => { From b0cc39264b3a28a12841be82a137a4e926637d65 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Wed, 6 Nov 2024 10:51:42 +0100 Subject: [PATCH 17/22] chore: rm redundant timing module import --- src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx index b3812ca4a9cb..057189ae22c1 100644 --- a/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx +++ b/src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx @@ -12,7 +12,6 @@ import TopBar from '@libs/Navigation/AppNavigator/createCustomBottomTabNavigator import Navigation from '@libs/Navigation/Navigation'; import Performance from '@libs/Performance'; import SidebarLinksData from '@pages/home/sidebar/SidebarLinksData'; -import Timing from '@userActions/Timing'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; From eb7f2db245d587a59df0d1a8d27bde494d07652b Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Fri, 8 Nov 2024 17:31:41 +0100 Subject: [PATCH 18/22] fix: linking test assertion scenario --- src/libs/E2E/tests/linkingTest.e2e.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libs/E2E/tests/linkingTest.e2e.ts b/src/libs/E2E/tests/linkingTest.e2e.ts index 6488d0c8bc70..2a85a5dabe6c 100644 --- a/src/libs/E2E/tests/linkingTest.e2e.ts +++ b/src/libs/E2E/tests/linkingTest.e2e.ts @@ -21,6 +21,7 @@ const test = (config: NativeConfig) => { console.debug('[E2E] Logging in for comment linking'); const reportID = getConfigValueOrThrow('reportID', config); + const linkedReportID = getConfigValueOrThrow('linkedReportID', config); const linkedReportActionID = getConfigValueOrThrow('linkedReportActionID', config); const name = getConfigValueOrThrow('name', config); @@ -55,12 +56,15 @@ const test = (config: NativeConfig) => { Performance.subscribeToMeasurements((entry) => { if (entry.name === CONST.TIMING.SIDEBAR_LOADED) { console.debug('[E2E] Sidebar loaded, navigating to a report…'); + Performance.markStart(CONST.TIMING.OPEN_REPORT); Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); return; } if (entry.name === CONST.TIMING.OPEN_REPORT) { console.debug('[E2E] Linking: 1'); + console.debug('[E2E] Navigating to the linked report action…'); + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(linkedReportID, linkedReportActionID)); E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, From 291dc29cff49cc20bccf2398e6b6ec4286069ef0 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Fri, 8 Nov 2024 17:43:48 +0100 Subject: [PATCH 19/22] feat: add missing performance markers, rename message_sent to send_message --- src/CONST.ts | 2 +- src/components/ReportActionItem/ReportPreview.tsx | 2 ++ src/libs/E2E/tests/reportTypingTest.e2e.ts | 2 +- .../home/report/ReportActionCompose/ReportActionCompose.tsx | 4 ++-- src/pages/home/report/ReportActionItemThread.tsx | 4 +++- src/pages/home/report/ReportActionsView.tsx | 4 ++++ src/pages/home/report/comment/TextCommentFragment.tsx | 4 ++-- 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 2fdef3e7a3d0..875539a19e4d 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1259,7 +1259,7 @@ const CONST = { OPEN_REPORT_THREAD: 'open_report_thread', SIDEBAR_LOADED: 'sidebar_loaded', LOAD_SEARCH_OPTIONS: 'load_search_options', - MESSAGE_SENT: 'message_sent', + SEND_MESSAGE: 'send_message', COLD: 'cold', WARM: 'warm', REPORT_ACTION_ITEM_LAYOUT_DEBOUNCE_TIME: 1500, diff --git a/src/components/ReportActionItem/ReportPreview.tsx b/src/components/ReportActionItem/ReportPreview.tsx index 9067f1abb11a..d476d1198808 100644 --- a/src/components/ReportActionItem/ReportPreview.tsx +++ b/src/components/ReportActionItem/ReportPreview.tsx @@ -27,6 +27,7 @@ import * as CurrencyUtils from '@libs/CurrencyUtils'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import HapticFeedback from '@libs/HapticFeedback'; import Navigation from '@libs/Navigation/Navigation'; +import Performance from '@libs/Performance'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReceiptUtils from '@libs/ReceiptUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; @@ -456,6 +457,7 @@ function ReportPreview({ { + Performance.markStart(CONST.TIMING.OPEN_REPORT_FROM_PREVIEW); Timing.start(CONST.TIMING.OPEN_REPORT_FROM_PREVIEW); Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(iouReportID)); }} diff --git a/src/libs/E2E/tests/reportTypingTest.e2e.ts b/src/libs/E2E/tests/reportTypingTest.e2e.ts index e042a688c37d..473bf317e6c0 100644 --- a/src/libs/E2E/tests/reportTypingTest.e2e.ts +++ b/src/libs/E2E/tests/reportTypingTest.e2e.ts @@ -43,7 +43,7 @@ const test = (config: NativeConfig) => { }); Performance.subscribeToMeasurements((entry) => { - if (entry.name === CONST.TIMING.MESSAGE_SENT) { + if (entry.name === CONST.TIMING.SEND_MESSAGE) { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, name: `${name} Message sent`, diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx index 8a6b88b8c25c..4285916b593d 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx @@ -274,8 +274,8 @@ function ReportActionCompose({ Report.addAttachment(reportID, attachmentFileRef.current, newCommentTrimmed); attachmentFileRef.current = null; } else { - Performance.markStart(CONST.TIMING.MESSAGE_SENT, {message: newCommentTrimmed}); - Timing.start(CONST.TIMING.MESSAGE_SENT); + Performance.markStart(CONST.TIMING.SEND_MESSAGE, {message: newCommentTrimmed}); + Timing.start(CONST.TIMING.SEND_MESSAGE); onSubmit(newCommentTrimmed); } }, diff --git a/src/pages/home/report/ReportActionItemThread.tsx b/src/pages/home/report/ReportActionItemThread.tsx index 94a8592d9607..13072a653749 100644 --- a/src/pages/home/report/ReportActionItemThread.tsx +++ b/src/pages/home/report/ReportActionItemThread.tsx @@ -7,6 +7,7 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Timing from '@libs/actions/Timing'; +import Performance from '@libs/Performance'; import * as Report from '@userActions/Report'; import CONST from '@src/CONST'; import type {Icon} from '@src/types/onyx/OnyxCommon'; @@ -45,8 +46,9 @@ function ReportActionItemThread({numberOfReplies, icons, mostRecentReply, childR { - Report.navigateToAndOpenChildReport(childReportID); + Performance.markStart(CONST.TIMING.OPEN_REPORT_THREAD); Timing.start(CONST.TIMING.OPEN_REPORT_THREAD); + Report.navigateToAndOpenChildReport(childReportID); }} role={CONST.ROLE.BUTTON} accessibilityLabel={`${numberOfReplies} ${replyText}`} diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx index 7b515c060205..31c0bc0fa752 100755 --- a/src/pages/home/report/ReportActionsView.tsx +++ b/src/pages/home/report/ReportActionsView.tsx @@ -428,7 +428,11 @@ function ReportActionsView({ Performance.markEnd(CONST.TIMING.OPEN_REPORT); Timing.end(CONST.TIMING.OPEN_REPORT); + + Performance.markEnd(CONST.TIMING.OPEN_REPORT_THREAD); Timing.end(CONST.TIMING.OPEN_REPORT_THREAD); + + Performance.markEnd(CONST.TIMING.OPEN_REPORT_FROM_PREVIEW); Timing.end(CONST.TIMING.OPEN_REPORT_FROM_PREVIEW); }, []); diff --git a/src/pages/home/report/comment/TextCommentFragment.tsx b/src/pages/home/report/comment/TextCommentFragment.tsx index 94c8f46845c6..ab06a594a17f 100644 --- a/src/pages/home/report/comment/TextCommentFragment.tsx +++ b/src/pages/home/report/comment/TextCommentFragment.tsx @@ -53,8 +53,8 @@ function TextCommentFragment({fragment, styleAsDeleted, styleAsMuted = false, so const {shouldUseNarrowLayout} = useResponsiveLayout(); useEffect(() => { - Performance.markEnd(CONST.TIMING.MESSAGE_SENT, {message: text}); - Timing.end(CONST.TIMING.MESSAGE_SENT); + Performance.markEnd(CONST.TIMING.SEND_MESSAGE, {message: text}); + Timing.end(CONST.TIMING.SEND_MESSAGE); }, [text]); // If the only difference between fragment.text and fragment.html is
tags and emoji tag From 669e3a085b02233e9b52c50da1526c7dd4d1f901 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Fri, 8 Nov 2024 17:53:13 +0100 Subject: [PATCH 20/22] chore: rm redundant timing module import --- src/libs/Navigation/AppNavigator/AuthScreens.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index d7f3cd2e80cc..a061d5b52d22 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -43,7 +43,6 @@ import * as PriorityMode from '@userActions/PriorityMode'; import * as Report from '@userActions/Report'; import * as Session from '@userActions/Session'; import toggleTestToolsModal from '@userActions/TestTool'; -import Timing from '@userActions/Timing'; import * as User from '@userActions/User'; import CONFIG from '@src/CONFIG'; import CONST from '@src/CONST'; From 216db097bcae11f55b238b6dd4909d2977b84030 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Fri, 8 Nov 2024 17:54:33 +0100 Subject: [PATCH 21/22] docs: rename message_sent to send_message --- contributingGuides/PERFORMANCE_METRICS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributingGuides/PERFORMANCE_METRICS.md b/contributingGuides/PERFORMANCE_METRICS.md index 4412de96a472..2ab652aad055 100644 --- a/contributingGuides/PERFORMANCE_METRICS.md +++ b/contributingGuides/PERFORMANCE_METRICS.md @@ -23,7 +23,7 @@ Project is using Firebase for tracking these metrics. However, not all of them a | `open_report` | ✅ | Time taken to open a report.

**Platforms:** All | Starts when the row in the `LHNOptionsList` is pressed. | Stops when the `ReportActionsList` finishes laying out. | | `open_report_from_preview` | ✅ | Time taken to open a report from preview.

(previously `switch_report_from_preview`)

**Platforms:** All | Starts when the user presses the Report Preview. | Stops when the `ReportActionsList` finishes laying out. | | `open_report_thread` | ✅ | Time taken to open a thread in a report.

**Platforms:** All | Starts when user presses Report Action Item. | Stops when the `ReportActionsList` finishes laying out. | -| `message_sent` | ✅ | Time taken to send a message.

**Platforms:** All | Starts when the new message is sent. | Stops when the message is being rendered in the chat. | +| `send_message` | ✅ | Time taken to send a message.

**Platforms:** All | Starts when the new message is sent. | Stops when the message is being rendered in the chat. | ## Documentation Maintenance From 11ff391035828260fc004e324d7195a6755db1c7 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Tue, 12 Nov 2024 15:02:50 +0100 Subject: [PATCH 22/22] fix: sidebar_loaded end event trigger & docs --- contributingGuides/PERFORMANCE_METRICS.md | 2 +- src/Expensify.tsx | 2 -- src/libs/actions/App.ts | 2 ++ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contributingGuides/PERFORMANCE_METRICS.md b/contributingGuides/PERFORMANCE_METRICS.md index 2ab652aad055..ecebbaae4e0e 100644 --- a/contributingGuides/PERFORMANCE_METRICS.md +++ b/contributingGuides/PERFORMANCE_METRICS.md @@ -14,7 +14,7 @@ Project is using Firebase for tracking these metrics. However, not all of them a | `js_loaded` | ✅ | The time it takes for the JavaScript bundle to load.

**Platforms:** Android, iOS | **Android:** Starts in the `onCreate` method.

**iOS:** Starts in the AppDelegate's `didFinishLaunchingWithOptions` method. | Stops at the first render of the app via native module on the JS side. | | `_app_in_foreground` | ✅ | The time when the app is running in the foreground and available to the user.

**Platforms:** Android, iOS | **Android:** Starts when the first activity to reach the foreground has its `onResume()` method called.

**iOS:** Starts when the application receives the `UIApplicationDidBecomeActiveNotification` notification. | **Android:** Stops when the last activity to leave the foreground has its `onStop()` method called.

**iOS:** Stops when it receives the `UIApplicationWillResignActiveNotification` notification. | | `_app_in_background` | ✅ | Time when the app is running in the background.

**Platforms:** Android, iOS | **Android:** Starts when the last activity to leave the foreground has its `onStop()` method called.

**iOS:** Starts when the application receives the `UIApplicationWillResignActiveNotification` notification. | **Android:** Stops when the first activity to reach the foreground has its `onResume()` method called.

**iOS:** Stops when it receives the `UIApplicationDidBecomeActiveNotification` notification. | -| `sidebar_loaded` | ❌ | Time taken for the Sidebar to load.

**Platforms:** All | Starts when the Sidebar is mounted. | Stops when the Splash Screen is hidden. | +| `sidebar_loaded` | ❌ | Time taken for the Sidebar to load.

**Platforms:** All | Starts when the Sidebar is mounted. | Stops when the LHN finishes laying out. | | `calc_most_recent_last_modified_action` | ✅ | Time taken to find the most recently modified report action or report.

**Platforms:** All | Starts when the app reconnects to the network | Ends when the app reconnects to the network and the most recent report action or report is found. | | `open_search` | ✅ | Time taken to open up the Search Router.

**Platforms:** All | Starts when the Search Router icon in LHN is pressed. | Stops when the list of available options finishes laying out. | | `load_search_options` | ✅ | Time taken to generate the list of options used in the Search Router.

**Platforms:** All | Starts when the `getSearchOptions` function is called. | Stops when the list of available options is generated. | diff --git a/src/Expensify.tsx b/src/Expensify.tsx index e07b03a6d405..1d0100add00f 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -30,7 +30,6 @@ import NavigationRoot from './libs/Navigation/NavigationRoot'; import NetworkConnection from './libs/NetworkConnection'; import PushNotification from './libs/Notification/PushNotification'; import './libs/Notification/PushNotification/subscribePushNotification'; -import Performance from './libs/Performance'; import setCrashlyticsUserId from './libs/setCrashlyticsUserId'; import StartupTimer from './libs/StartupTimer'; // This lib needs to be imported, but it has nothing to export since all it contains is an Onyx connection @@ -138,7 +137,6 @@ function Expensify() { const onSplashHide = useCallback(() => { setSplashScreenState(CONST.BOOT_SPLASH_STATE.HIDDEN); - Performance.markEnd(CONST.TIMING.SIDEBAR_LOADED); }, [setSplashScreenState]); useLayoutEffect(() => { diff --git a/src/libs/actions/App.ts b/src/libs/actions/App.ts index f304c4522796..f778405ee6e8 100644 --- a/src/libs/actions/App.ts +++ b/src/libs/actions/App.ts @@ -14,6 +14,7 @@ import {buildEmojisTrie} from '@libs/EmojiTrie'; import Log from '@libs/Log'; import getCurrentUrl from '@libs/Navigation/currentUrl'; import Navigation from '@libs/Navigation/Navigation'; +import Performance from '@libs/Performance'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as SessionUtils from '@libs/SessionUtils'; import {clearSoundAssetsCache} from '@libs/Sound'; @@ -178,6 +179,7 @@ function setSidebarLoaded() { } Onyx.set(ONYXKEYS.IS_SIDEBAR_LOADED, true); + Performance.markEnd(CONST.TIMING.SIDEBAR_LOADED); } let appState: AppStateStatus;