From 8137c93fbfc7c478a01f3a521f0b59b1d2710a07 Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 12 Jun 2024 00:12:21 +0700 Subject: [PATCH 1/9] fix RBR transaction thread is disappearing from the LHN when navigating to another chat v2 --- src/libs/OptionsListUtils.ts | 29 +++++++++++++----- src/libs/Permissions.ts | 1 + src/libs/ReportUtils.ts | 2 +- src/libs/SidebarUtils.ts | 59 +++++++++++++++++++++--------------- 4 files changed, 59 insertions(+), 32 deletions(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 9840e29ff347..8cd2615dc4a6 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -1686,6 +1686,26 @@ function getUserToInviteOption({ return userToInvite; } +/** + * Check whether report has violations + */ +function shouldShowViolations(report: Report, betas: OnyxEntry, transactionViolations: OnyxCollection) { + if (!Permissions.canUseViolations(betas)) { + return false; + } + const {parentReportID, parentReportActionID} = report ?? {}; + const canGetParentReport = parentReportID && parentReportActionID && allReportActions; + if (!canGetParentReport) { + return false; + } + const parentReportActions = allReportActions ? allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`] ?? {} : {}; + const parentReportAction = parentReportActions[parentReportActionID] ?? null; + if (!parentReportAction) { + return false; + } + return ReportUtils.shouldDisplayTransactionThreadViolations(report, transactionViolations, parentReportAction); +} + /** * filter options based on specific conditions */ @@ -1793,13 +1813,7 @@ function getOptions( // Filter out all the reports that shouldn't be displayed const filteredReportOptions = options.reports.filter((option) => { const report = option.item; - - const {parentReportID, parentReportActionID} = report ?? {}; - const canGetParentReport = parentReportID && parentReportActionID && allReportActions; - const parentReportActions = allReportActions ? allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`] ?? {} : {}; - const parentReportAction = canGetParentReport ? parentReportActions[parentReportActionID] ?? null : null; - const doesReportHaveViolations = - (betas?.includes(CONST.BETAS.VIOLATIONS) && ReportUtils.doesTransactionThreadHaveViolations(report, transactionViolations, parentReportAction)) ?? false; + const doesReportHaveViolations = shouldShowViolations(report, betas, transactionViolations); return ReportUtils.shouldReportBeInOptionList({ report, @@ -2493,6 +2507,7 @@ export { getTaxRatesSection, getFirstKeyForList, getUserToInviteOption, + shouldShowViolations, }; export type {MemberForList, CategorySection, CategoryTreeSection, Options, OptionList, SearchOption, PayeePersonalDetails, Category, Tax, TaxRatesOption, Option, OptionTree}; diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index 45551fe1cad9..bcbdded124f6 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -4,6 +4,7 @@ import type {IOUType} from '@src/CONST'; import type Beta from '@src/types/onyx/Beta'; function canUseAllBetas(betas: OnyxEntry): boolean { + return true return !!betas?.includes(CONST.BETAS.ALL); } diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 4de976aaf160..438715d53969 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1422,7 +1422,7 @@ function isOneTransactionReport(reportID: string): boolean { function isOneTransactionThread(reportID: string, parentReportID: string): boolean { const parentReportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`] ?? ([] as ReportAction[]); const transactionThreadReportID = ReportActionsUtils.getOneTransactionThreadReportID(parentReportID, parentReportActions); - return reportID === transactionThreadReportID; + return reportID?.toString() === transactionThreadReportID?.toString(); } /** diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 3df823db22df..b821f34a37a2 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -80,40 +80,47 @@ function getOrderedReportIDs( const allReportsDictValues = Object.values(allReports ?? {}); // Filter out all the reports that shouldn't be displayed - let reportsToDisplay = allReportsDictValues.filter((report) => { + let reportsToDisplay: Array = []; + allReportsDictValues.forEach((report) => { if (!report) { - return false; + return; } - - const parentReportActionsKey = `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`; - const parentReportActions = allReportActions?.[parentReportActionsKey]; const reportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`] ?? {}; - const parentReportAction = parentReportActions?.find((action) => action && action?.reportActionID === report.parentReportActionID); - const doesReportHaveViolations = !!( - betas?.includes(CONST.BETAS.VIOLATIONS) && - !!parentReportAction && - ReportUtils.doesTransactionThreadHaveViolations(report, transactionViolations, parentReportAction as OnyxEntry) - ); + const doesReportHaveViolations = OptionsListUtils.shouldShowViolations(report, betas ?? [], transactionViolations); const isHidden = report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; const isFocused = report.reportID === currentReportId; const allReportErrors = OptionsListUtils.getAllReportErrors(report, reportActions) ?? {}; const hasErrorsOtherThanFailedReceipt = doesReportHaveViolations || Object.values(allReportErrors).some((error) => error?.[0] !== 'report.genericSmartscanFailureMessage'); + if (ReportUtils.isOneTransactionThread(report.reportID, report.parentReportID ?? '0')) { + return; + } + if (hasErrorsOtherThanFailedReceipt) { + reportsToDisplay.push({ + ...report, + hasErrorsOtherThanFailedReceipt: true, + }); + return; + } const isSystemChat = ReportUtils.isSystemChat(report); const shouldOverrideHidden = hasErrorsOtherThanFailedReceipt || isFocused || isSystemChat || report.isPinned; if (isHidden && !shouldOverrideHidden) { - return false; + return; } - return ReportUtils.shouldReportBeInOptionList({ - report, - currentReportId: currentReportId ?? '', - isInFocusMode, - betas, - policies: policies as OnyxCollection, - excludeEmptyChats: true, - doesReportHaveViolations, - includeSelfDM: true, - }); + if ( + ReportUtils.shouldReportBeInOptionList({ + report, + currentReportId: currentReportId ?? '', + isInFocusMode, + betas, + policies: policies as OnyxCollection, + excludeEmptyChats: true, + doesReportHaveViolations, + includeSelfDM: true, + }) + ) { + reportsToDisplay.push(report); + } }); // The LHN is split into four distinct groups, and each group is sorted a little differently. The groups will ALWAYS be in this order: @@ -129,6 +136,7 @@ function getOrderedReportIDs( const draftReports: Array> = []; const nonArchivedReports: Array> = []; const archivedReports: Array> = []; + const errorReports: Array> = []; if (currentPolicyID || policyMemberAccountIDs.length > 0) { reportsToDisplay = reportsToDisplay.filter( @@ -137,7 +145,7 @@ function getOrderedReportIDs( } // There are a few properties that need to be calculated for the report which are used when sorting reports. reportsToDisplay.forEach((reportToDisplay) => { - let report = reportToDisplay as OnyxEntry; + let report = reportToDisplay; if (report) { report = { ...report, @@ -153,6 +161,8 @@ function getOrderedReportIDs( draftReports.push(report); } else if (ReportUtils.isArchivedRoom(report)) { archivedReports.push(report); + } else if (report?.hasErrorsOtherThanFailedReceipt) { + errorReports.push(report); } else { nonArchivedReports.push(report); } @@ -160,6 +170,7 @@ function getOrderedReportIDs( // Sort each group of reports accordingly pinnedAndGBRReports.sort((a, b) => (a?.displayName && b?.displayName ? localeCompare(a.displayName, b.displayName) : 0)); + errorReports.sort((a, b) => (a?.displayName && b?.displayName ? localeCompare(a.displayName, b.displayName) : 0)); draftReports.sort((a, b) => (a?.displayName && b?.displayName ? localeCompare(a.displayName, b.displayName) : 0)); if (isInDefaultMode) { @@ -180,7 +191,7 @@ function getOrderedReportIDs( // Now that we have all the reports grouped and sorted, they must be flattened into an array and only return the reportID. // The order the arrays are concatenated in matters and will determine the order that the groups are displayed in the sidebar. - const LHNReports = [...pinnedAndGBRReports, ...draftReports, ...nonArchivedReports, ...archivedReports].map((report) => report?.reportID ?? ''); + const LHNReports = [...pinnedAndGBRReports, ...errorReports, ...draftReports, ...nonArchivedReports, ...archivedReports].map((report) => report?.reportID ?? ''); return LHNReports; } From 5f3ce23292c7abf97a5a2247b8c384d8c8f245eb Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 12 Jun 2024 00:58:12 +0700 Subject: [PATCH 2/9] fix lint --- src/libs/Permissions.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index bcbdded124f6..45551fe1cad9 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -4,7 +4,6 @@ import type {IOUType} from '@src/CONST'; import type Beta from '@src/types/onyx/Beta'; function canUseAllBetas(betas: OnyxEntry): boolean { - return true return !!betas?.includes(CONST.BETAS.ALL); } From dffc44bc2fb151671208741b6880dd1af03fdf1a Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 20 Jun 2024 03:47:17 +0700 Subject: [PATCH 3/9] fix remove unused change --- src/libs/ReportUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 73947734ab2b..8a30936ba33a 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1429,7 +1429,7 @@ function isOneTransactionReport(reportID: string): boolean { function isOneTransactionThread(reportID: string, parentReportID: string): boolean { const parentReportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`] ?? ([] as ReportAction[]); const transactionThreadReportID = ReportActionsUtils.getOneTransactionThreadReportID(parentReportID, parentReportActions); - return reportID?.toString() === transactionThreadReportID?.toString(); + return reportID === transactionThreadReportID; } /** From 8ccc4f5b6be6456d82b4054d73dadf881721e26a Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 20 Jun 2024 04:43:12 +0700 Subject: [PATCH 4/9] fix display RBR in case oneTransactionReport --- .../LHNOptionsList/OptionRowLHNData.tsx | 15 +++++++++++++-- src/libs/SidebarUtils.ts | 8 ++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHNData.tsx b/src/components/LHNOptionsList/OptionRowLHNData.tsx index a2dd41eab0bd..128d90376eeb 100644 --- a/src/components/LHNOptionsList/OptionRowLHNData.tsx +++ b/src/components/LHNOptionsList/OptionRowLHNData.tsx @@ -1,10 +1,13 @@ import {deepEqual} from 'fast-equals'; import React, {useMemo, useRef} from 'react'; import useCurrentReportID from '@hooks/useCurrentReportID'; +import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import SidebarUtils from '@libs/SidebarUtils'; import CONST from '@src/CONST'; import type {OptionData} from '@src/libs/ReportUtils'; +import ONYXKEYS from '@src/ONYXKEYS'; +import {isEmptyObject} from '@src/types/utils/EmptyObject'; import OptionRowLHN from './OptionRowLHN'; import type {OptionRowLHNDataProps} from './types'; @@ -35,8 +38,16 @@ function OptionRowLHNData({ const optionItemRef = useRef(); - const shouldDisplayViolations = canUseViolations && ReportUtils.shouldDisplayTransactionThreadViolations(fullReport, transactionViolations, parentReportAction); - + let shouldDisplayViolations = canUseViolations && ReportUtils.shouldDisplayTransactionThreadViolations(fullReport, transactionViolations, parentReportAction); + const oneTransactionThreadReportID = ReportActionsUtils.getOneTransactionThreadReportID(reportID, reportActions); + const isOneTransactionReport = oneTransactionThreadReportID !== null; + if (isOneTransactionReport) { + const transactionReport = ReportUtils.getReport(oneTransactionThreadReportID); + const parentTransactionAction = ReportActionsUtils.getParentReportAction(transactionReport); + if (transactionReport && !isEmptyObject(parentTransactionAction)) { + shouldDisplayViolations = canUseViolations && ReportUtils.shouldDisplayTransactionThreadViolations(transactionReport, transactionViolations, parentTransactionAction); + } + } const optionItem = useMemo(() => { // Note: ideally we'd have this as a dependent selector in onyx! const item = SidebarUtils.getOptionData({ diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 800bea33c1b3..697fa9661862 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -290,7 +290,15 @@ function getOptionData({ result.isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report); result.shouldShowSubscript = ReportUtils.shouldReportShowSubscript(report); result.pendingAction = report.pendingFields?.addWorkspaceRoom ?? report.pendingFields?.createChat; + result.brickRoadIndicator = hasErrors || hasViolations ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''; + const oneTransactionThreadReportID = ReportActionsUtils.getOneTransactionThreadReportID(report.reportID, reportActions); + const isOneTransactionReport = oneTransactionThreadReportID !== null; + if (isOneTransactionReport) { + const allTransactionErrors = OptionsListUtils.getAllReportErrors(report, reportActions); + const hasTransactionErrors = Object.keys(allTransactionErrors ?? {}).length !== 0; + result.brickRoadIndicator = hasTransactionErrors || hasViolations ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''; + } result.ownerAccountID = report.ownerAccountID; result.managerID = report.managerID; result.reportID = report.reportID; From 2308150fdfd1dca46f65cd8ed09834a8d64d6109 Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 20 Jun 2024 05:12:15 +0700 Subject: [PATCH 5/9] fix lint --- src/components/LHNOptionsList/OptionRowLHNData.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/LHNOptionsList/OptionRowLHNData.tsx b/src/components/LHNOptionsList/OptionRowLHNData.tsx index 128d90376eeb..b4dd76ca0405 100644 --- a/src/components/LHNOptionsList/OptionRowLHNData.tsx +++ b/src/components/LHNOptionsList/OptionRowLHNData.tsx @@ -6,7 +6,6 @@ import * as ReportUtils from '@libs/ReportUtils'; import SidebarUtils from '@libs/SidebarUtils'; import CONST from '@src/CONST'; import type {OptionData} from '@src/libs/ReportUtils'; -import ONYXKEYS from '@src/ONYXKEYS'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import OptionRowLHN from './OptionRowLHN'; import type {OptionRowLHNDataProps} from './types'; From 29653970f15ffb52b0cb06face1bb9a2ab92daf7 Mon Sep 17 00:00:00 2001 From: tienifr Date: Mon, 24 Jun 2024 17:27:56 +0700 Subject: [PATCH 6/9] fix lint --- .../LHNOptionsList/OptionRowLHNData.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHNData.tsx b/src/components/LHNOptionsList/OptionRowLHNData.tsx index b4dd76ca0405..ee91c4743e97 100644 --- a/src/components/LHNOptionsList/OptionRowLHNData.tsx +++ b/src/components/LHNOptionsList/OptionRowLHNData.tsx @@ -1,15 +1,26 @@ import {deepEqual} from 'fast-equals'; import React, {useMemo, useRef} from 'react'; +import type {OnyxCollection} from 'react-native-onyx'; +import Onyx from 'react-native-onyx'; import useCurrentReportID from '@hooks/useCurrentReportID'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import SidebarUtils from '@libs/SidebarUtils'; import CONST from '@src/CONST'; import type {OptionData} from '@src/libs/ReportUtils'; +import ONYXKEYS from '@src/ONYXKEYS'; +import type {Report} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import OptionRowLHN from './OptionRowLHN'; import type {OptionRowLHNDataProps} from './types'; +let allReports: OnyxCollection; +Onyx.connect({ + key: ONYXKEYS.COLLECTION.REPORT, + waitForCollectionCallback: true, + callback: (value) => (allReports = value), +}); + /* * This component gets the data from onyx for the actual * OptionRowLHN component. @@ -40,8 +51,8 @@ function OptionRowLHNData({ let shouldDisplayViolations = canUseViolations && ReportUtils.shouldDisplayTransactionThreadViolations(fullReport, transactionViolations, parentReportAction); const oneTransactionThreadReportID = ReportActionsUtils.getOneTransactionThreadReportID(reportID, reportActions); const isOneTransactionReport = oneTransactionThreadReportID !== null; - if (isOneTransactionReport) { - const transactionReport = ReportUtils.getReport(oneTransactionThreadReportID); + if (isOneTransactionReport && oneTransactionThreadReportID) { + const transactionReport = allReports?.[oneTransactionThreadReportID]; const parentTransactionAction = ReportActionsUtils.getParentReportAction(transactionReport); if (transactionReport && !isEmptyObject(parentTransactionAction)) { shouldDisplayViolations = canUseViolations && ReportUtils.shouldDisplayTransactionThreadViolations(transactionReport, transactionViolations, parentTransactionAction); From cea215f627ad691858d82c09a5ab3469b924d36b Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 27 Jun 2024 22:55:07 +0700 Subject: [PATCH 7/9] fix revert fix display RBR in case oneTransactionReport --- src/components/LHNOptionsList/OptionRowLHNData.tsx | 13 +------------ src/libs/SidebarUtils.ts | 8 -------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHNData.tsx b/src/components/LHNOptionsList/OptionRowLHNData.tsx index 466ffd754403..acd7279b3b51 100644 --- a/src/components/LHNOptionsList/OptionRowLHNData.tsx +++ b/src/components/LHNOptionsList/OptionRowLHNData.tsx @@ -3,14 +3,12 @@ import React, {useMemo, useRef} from 'react'; import type {OnyxCollection} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import useCurrentReportID from '@hooks/useCurrentReportID'; -import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import SidebarUtils from '@libs/SidebarUtils'; import CONST from '@src/CONST'; import type {OptionData} from '@src/libs/ReportUtils'; import ONYXKEYS from '@src/ONYXKEYS'; import type {Report} from '@src/types/onyx'; -import {isEmptyObject} from '@src/types/utils/EmptyObject'; import OptionRowLHN from './OptionRowLHN'; import type {OptionRowLHNDataProps} from './types'; @@ -48,16 +46,7 @@ function OptionRowLHNData({ const optionItemRef = useRef(); - let shouldDisplayViolations = canUseViolations && ReportUtils.shouldDisplayTransactionThreadViolations(fullReport, transactionViolations, parentReportAction); - const oneTransactionThreadReportID = ReportActionsUtils.getOneTransactionThreadReportID(reportID, reportActions); - const isOneTransactionReport = oneTransactionThreadReportID !== null; - if (isOneTransactionReport && oneTransactionThreadReportID) { - const transactionReport = allReports?.[oneTransactionThreadReportID]; - const parentTransactionAction = ReportActionsUtils.getParentReportAction(transactionReport); - if (transactionReport && !isEmptyObject(parentTransactionAction)) { - shouldDisplayViolations = canUseViolations && ReportUtils.shouldDisplayTransactionThreadViolations(transactionReport, transactionViolations, parentTransactionAction); - } - } + const shouldDisplayViolations = canUseViolations && ReportUtils.shouldDisplayTransactionThreadViolations(fullReport, transactionViolations, parentReportAction); const optionItem = useMemo(() => { // Note: ideally we'd have this as a dependent selector in onyx! const item = SidebarUtils.getOptionData({ diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 422485091885..d48404349057 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -275,15 +275,7 @@ function getOptionData({ result.isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report); result.shouldShowSubscript = ReportUtils.shouldReportShowSubscript(report); result.pendingAction = report.pendingFields?.addWorkspaceRoom ?? report.pendingFields?.createChat; - result.brickRoadIndicator = hasErrors || hasViolations ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''; - const oneTransactionThreadReportID = ReportActionsUtils.getOneTransactionThreadReportID(report.reportID, reportActions); - const isOneTransactionReport = oneTransactionThreadReportID !== null; - if (isOneTransactionReport) { - const allTransactionErrors = OptionsListUtils.getAllReportErrors(report, reportActions); - const hasTransactionErrors = Object.keys(allTransactionErrors ?? {}).length !== 0; - result.brickRoadIndicator = hasTransactionErrors || hasViolations ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''; - } result.ownerAccountID = report.ownerAccountID; result.managerID = report.managerID; result.reportID = report.reportID; From fc06e432c6a81f60ff8534f59e4232c16a4420c4 Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 27 Jun 2024 22:57:51 +0700 Subject: [PATCH 8/9] fix remove unsed logic --- src/components/LHNOptionsList/OptionRowLHNData.tsx | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHNData.tsx b/src/components/LHNOptionsList/OptionRowLHNData.tsx index acd7279b3b51..564b7ec8af50 100644 --- a/src/components/LHNOptionsList/OptionRowLHNData.tsx +++ b/src/components/LHNOptionsList/OptionRowLHNData.tsx @@ -1,24 +1,13 @@ import {deepEqual} from 'fast-equals'; import React, {useMemo, useRef} from 'react'; -import type {OnyxCollection} from 'react-native-onyx'; -import Onyx from 'react-native-onyx'; import useCurrentReportID from '@hooks/useCurrentReportID'; import * as ReportUtils from '@libs/ReportUtils'; import SidebarUtils from '@libs/SidebarUtils'; import CONST from '@src/CONST'; import type {OptionData} from '@src/libs/ReportUtils'; -import ONYXKEYS from '@src/ONYXKEYS'; -import type {Report} from '@src/types/onyx'; import OptionRowLHN from './OptionRowLHN'; import type {OptionRowLHNDataProps} from './types'; -let allReports: OnyxCollection; -Onyx.connect({ - key: ONYXKEYS.COLLECTION.REPORT, - waitForCollectionCallback: true, - callback: (value) => (allReports = value), -}); - /* * This component gets the data from onyx for the actual * OptionRowLHN component. From c9a612c784cddfc309e4e5cec08dd38b8cac6357 Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 27 Jun 2024 22:58:31 +0700 Subject: [PATCH 9/9] fix add one line --- src/components/LHNOptionsList/OptionRowLHNData.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/LHNOptionsList/OptionRowLHNData.tsx b/src/components/LHNOptionsList/OptionRowLHNData.tsx index 564b7ec8af50..8d61058ed5be 100644 --- a/src/components/LHNOptionsList/OptionRowLHNData.tsx +++ b/src/components/LHNOptionsList/OptionRowLHNData.tsx @@ -36,6 +36,7 @@ function OptionRowLHNData({ const optionItemRef = useRef(); const shouldDisplayViolations = canUseViolations && ReportUtils.shouldDisplayTransactionThreadViolations(fullReport, transactionViolations, parentReportAction); + const optionItem = useMemo(() => { // Note: ideally we'd have this as a dependent selector in onyx! const item = SidebarUtils.getOptionData({