From 22042e51213dacff39a9ad280bb8e729fe66ca65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Fija=C5=82kiewicz?= Date: Mon, 21 Aug 2023 16:25:37 +0200 Subject: [PATCH] destructure the props --- src/pages/SearchPage.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/SearchPage.js b/src/pages/SearchPage.js index bbd9364d6821..8ceb8599ddcf 100755 --- a/src/pages/SearchPage.js +++ b/src/pages/SearchPage.js @@ -38,7 +38,7 @@ const defaultProps = { reports: {}, }; -function SearchPage(props) { +function SearchPage({betas, personalDetails, reports}) { // Data for initialization (runs only on the first render) const { recentReports: initialRecentReports, @@ -46,7 +46,7 @@ function SearchPage(props) { userToInvite: initialUserToInvite, // Ignoring the rule because in this case we need the data only initially // eslint-disable-next-line react-hooks/exhaustive-deps - } = useMemo(() => OptionsListUtils.getSearchOptions(props.reports, props.personalDetails, '', props.betas), []); + } = useMemo(() => OptionsListUtils.getSearchOptions(reports, personalDetails, '', betas), []); const [searchValue, setSearchValue] = useState(''); const [searchOptions, setSearchOptions] = useState({ @@ -62,14 +62,14 @@ function SearchPage(props) { recentReports: localRecentReports, personalDetails: localPersonalDetails, userToInvite: localUserToInvite, - } = OptionsListUtils.getSearchOptions(props.reports, props.personalDetails, searchValue.trim(), props.betas); + } = OptionsListUtils.getSearchOptions(reports, personalDetails, searchValue.trim(), betas); setSearchOptions({ recentReports: localRecentReports, personalDetails: localPersonalDetails, userToInvite: localUserToInvite, }); - }, [props.reports, props.personalDetails, searchValue, props.betas]); + }, [reports, personalDetails, searchValue, betas]); const debouncedUpdateOptions = useMemo(() => _.debounce(updateOptions, 75), [updateOptions]); @@ -146,7 +146,7 @@ function SearchPage(props) { } }; - const isOptionsDataReady = ReportUtils.isReportDataReady() && OptionsListUtils.isPersonalDetailsReady(props.personalDetails); + const isOptionsDataReady = ReportUtils.isReportDataReady() && OptionsListUtils.isPersonalDetailsReady(personalDetails); const headerMessage = OptionsListUtils.getHeaderMessage( searchOptions.recentReports.length + searchOptions.personalDetails.length !== 0, Boolean(searchOptions.userToInvite),