From 47a9218781288a820db38596c18624af3e4b6c2b Mon Sep 17 00:00:00 2001 From: situchan Date: Thu, 15 Jun 2023 18:01:25 +0100 Subject: [PATCH] remove wrong performance measurement in task assignee selector, share destination pages --- src/pages/tasks/TaskAssigneeSelectorModal.js | 23 ++----------------- .../TaskShareDestinationSelectorModal.js | 23 ++----------------- 2 files changed, 4 insertions(+), 42 deletions(-) diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index 8c40cba348c0..c9e80e0343dc 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.js +++ b/src/pages/tasks/TaskAssigneeSelectorModal.js @@ -1,5 +1,5 @@ /* eslint-disable es/no-optional-chaining */ -import React, {useState, useEffect, useCallback, useMemo} from 'react'; +import React, {useState, useEffect, useMemo} from 'react'; import {View} from 'react-native'; import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; @@ -10,13 +10,11 @@ import styles from '../../styles/styles'; import Navigation from '../../libs/Navigation/Navigation'; import HeaderWithBackButton from '../../components/HeaderWithBackButton'; import ScreenWrapper from '../../components/ScreenWrapper'; -import Timing from '../../libs/actions/Timing'; import CONST from '../../CONST'; import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; import compose from '../../libs/compose'; import personalDetailsPropType from '../personalDetailsPropType'; import reportPropTypes from '../reportPropTypes'; -import Performance from '../../libs/Performance'; import ROUTES from '../../ROUTES'; import * as TaskUtils from '../../libs/actions/Task'; @@ -86,7 +84,7 @@ function TaskAssigneeSelectorModal(props) { setFilteredCurrentUserOption(results.currentUserOption); }, [props]); - const updateOptions = useCallback(() => { + useEffect(() => { const {recentReports, personalDetails, userToInvite, currentUserOption} = OptionsListUtils.getNewChatOptions( props.reports, props.personalDetails, @@ -105,21 +103,8 @@ function TaskAssigneeSelectorModal(props) { setFilteredCurrentUserOption(currentUserOption); }, [props, searchValue]); - useEffect(() => { - Timing.start(CONST.TIMING.SEARCH_RENDER); - Performance.markStart(CONST.TIMING.SEARCH_RENDER); - - updateOptions(); - - return () => { - Timing.end(CONST.TIMING.SEARCH_RENDER); - Performance.markEnd(CONST.TIMING.SEARCH_RENDER); - }; - }, [updateOptions]); - const onChangeText = (newSearchTerm = '') => { setSearchValue(newSearchTerm); - updateOptions(); }; const sections = useMemo(() => { @@ -205,10 +190,6 @@ function TaskAssigneeSelectorModal(props) { showTitleTooltip shouldShowOptions={didScreenTransitionEnd} placeholderText={props.translate('optionsSelector.nameEmailOrPhoneNumber')} - onLayout={() => { - Timing.end(CONST.TIMING.SEARCH_RENDER); - Performance.markEnd(CONST.TIMING.SEARCH_RENDER); - }} safeAreaPaddingBottomStyle={safeAreaPaddingBottomStyle} /> diff --git a/src/pages/tasks/TaskShareDestinationSelectorModal.js b/src/pages/tasks/TaskShareDestinationSelectorModal.js index cb2f500195a0..329f4a410ccf 100644 --- a/src/pages/tasks/TaskShareDestinationSelectorModal.js +++ b/src/pages/tasks/TaskShareDestinationSelectorModal.js @@ -1,5 +1,5 @@ /* eslint-disable es/no-optional-chaining */ -import React, {useState, useEffect, useCallback} from 'react'; +import React, {useState, useEffect} from 'react'; import {View} from 'react-native'; import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; @@ -10,13 +10,11 @@ import styles from '../../styles/styles'; import Navigation from '../../libs/Navigation/Navigation'; import HeaderWithBackButton from '../../components/HeaderWithBackButton'; import ScreenWrapper from '../../components/ScreenWrapper'; -import Timing from '../../libs/actions/Timing'; import CONST from '../../CONST'; import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; import compose from '../../libs/compose'; import personalDetailsPropType from '../personalDetailsPropType'; import reportPropTypes from '../reportPropTypes'; -import Performance from '../../libs/Performance'; import * as TaskUtils from '../../libs/actions/Task'; import ROUTES from '../../ROUTES'; @@ -56,7 +54,7 @@ function TaskShareDestinationSelectorModal(props) { setFilteredPersonalDetails(results.personalDetails); }, [props]); - const updateOptions = useCallback(() => { + useEffect(() => { const {recentReports, personalDetails, userToInvite} = OptionsListUtils.getShareDestinationOptions( props.reports, props.personalDetails, @@ -74,21 +72,8 @@ function TaskShareDestinationSelectorModal(props) { setFilteredPersonalDetails(personalDetails); }, [props, searchValue]); - useEffect(() => { - Timing.start(CONST.TIMING.SEARCH_RENDER); - Performance.markStart(CONST.TIMING.SEARCH_RENDER); - - updateOptions(); - - return () => { - Timing.end(CONST.TIMING.SEARCH_RENDER); - Performance.markEnd(CONST.TIMING.SEARCH_RENDER); - }; - }, [updateOptions]); - const onChangeText = (newSearchTerm = '') => { setSearchValue(newSearchTerm); - updateOptions(); }; const getSections = () => { @@ -158,10 +143,6 @@ function TaskShareDestinationSelectorModal(props) { showTitleTooltip shouldShowOptions={didScreenTransitionEnd} placeholderText={props.translate('optionsSelector.nameEmailOrPhoneNumber')} - onLayout={() => { - Timing.end(CONST.TIMING.SEARCH_RENDER); - Performance.markEnd(CONST.TIMING.SEARCH_RENDER); - }} safeAreaPaddingBottomStyle={safeAreaPaddingBottomStyle} />