diff --git a/src/components/AnonymousReportFooter.tsx b/src/components/AnonymousReportFooter.tsx index 0f2baad10aa50..16707cccb1ff8 100644 --- a/src/components/AnonymousReportFooter.tsx +++ b/src/components/AnonymousReportFooter.tsx @@ -1,26 +1,32 @@ import React from 'react'; import {View} from 'react-native'; -import type {OnyxEntry} from 'react-native-onyx'; +import useIsInSidePanel from '@hooks/useIsInSidePanel'; import useLocalize from '@hooks/useLocalize'; +import useOnyx from '@hooks/useOnyx'; +import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; +import useWindowDimensions from '@hooks/useWindowDimensions'; +import variables from '@styles/variables'; import {signOutAndRedirectToSignIn} from '@userActions/Session'; -import type {Report} from '@src/types/onyx'; +import ONYXKEYS from '@src/ONYXKEYS'; import AvatarWithDisplayName from './AvatarWithDisplayName'; import Button from './Button'; import ExpensifyWordmark from './ExpensifyWordmark'; import Text from './Text'; type AnonymousReportFooterProps = { - /** The report currently being looked at */ - report: OnyxEntry; - - /** Whether the small screen size layout should be used */ - isSmallSizeLayout?: boolean; + /** The reportID of the report currently being looked at */ + reportID: string | undefined; }; -function AnonymousReportFooter({isSmallSizeLayout = false, report}: AnonymousReportFooterProps) { +function AnonymousReportFooter({reportID}: AnonymousReportFooterProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); + const isInSidePanel = useIsInSidePanel(); + const {shouldUseNarrowLayout} = useResponsiveLayout(); + const {windowWidth} = useWindowDimensions(); + const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`); + const isSmallSizeLayout = windowWidth - (shouldUseNarrowLayout ? 0 : variables.sideBarWithLHBWidth) < variables.anonymousReportFooterBreakpoint || isInSidePanel; return ( diff --git a/src/components/ArchivedReportFooter.tsx b/src/components/ArchivedReportFooter.tsx index 66abbf25d0410..6f7456ec004e2 100644 --- a/src/components/ArchivedReportFooter.tsx +++ b/src/components/ArchivedReportFooter.tsx @@ -1,6 +1,7 @@ import {getLastClosedReportAction} from '@selectors/ReportAction'; import lodashEscape from 'lodash/escape'; import React from 'react'; +import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -9,23 +10,23 @@ import {getOriginalMessage, isClosedAction} from '@libs/ReportActionsUtils'; import {getPolicyName} from '@libs/ReportUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import type {PersonalDetailsList, Report} from '@src/types/onyx'; +import type {PersonalDetailsList} from '@src/types/onyx'; import {getEmptyObject} from '@src/types/utils/EmptyObject'; import Banner from './Banner'; type ArchivedReportFooterProps = { - /** The archived report */ - report: Report; - /** Current user's account id */ - currentUserAccountID: number; + /** The reportID of the archived report */ + reportID: string; }; -function ArchivedReportFooter({report, currentUserAccountID}: ArchivedReportFooterProps) { +function ArchivedReportFooter({reportID}: ArchivedReportFooterProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); + const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails(); + const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`); const [personalDetails = getEmptyObject()] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); - const [reportClosedAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, {canEvict: false, selector: getLastClosedReportAction}); + const [reportClosedAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {canEvict: false, selector: getLastClosedReportAction}); const originalMessage = isClosedAction(reportClosedAction) ? getOriginalMessage(reportClosedAction) : null; const archiveReason = originalMessage?.reason ?? CONST.REPORT.ARCHIVE_REASON.DEFAULT; const actorPersonalDetails = personalDetails?.[reportClosedAction?.actorAccountID ?? CONST.DEFAULT_NUMBER_ID]; diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 8ec52aeb35c4f..29bc455869351 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -8,7 +8,6 @@ import truncate from 'lodash/truncate'; import React, {useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react'; import type {StyleProp, ViewStyle} from 'react-native'; import {InteractionManager, View} from 'react-native'; -import type {OnyxEntry} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; import useActiveAdminPolicies from '@hooks/useActiveAdminPolicies'; import useConfirmModal from '@hooks/useConfirmModal'; @@ -23,6 +22,7 @@ import useLocalize from '@hooks/useLocalize'; import useMobileSelectionMode from '@hooks/useMobileSelectionMode'; import useNetwork from '@hooks/useNetwork'; import useOnyx from '@hooks/useOnyx'; +import usePaginatedReportActions from '@hooks/usePaginatedReportActions'; import useParticipantsInvoiceReport from '@hooks/useParticipantsInvoiceReport'; import usePaymentAnimations from '@hooks/usePaymentAnimations'; import usePaymentOptions from '@hooks/usePaymentOptions'; @@ -30,6 +30,7 @@ import usePermissions from '@hooks/usePermissions'; import usePersonalPolicy from '@hooks/usePersonalPolicy'; import usePolicy from '@hooks/usePolicy'; import useReportIsArchived from '@hooks/useReportIsArchived'; +import useReportTransactionsCollection from '@hooks/useReportTransactionsCollection'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useResponsiveLayoutOnWideRHP from '@hooks/useResponsiveLayoutOnWideRHP'; import useSearchShouldCalculateTotals from '@hooks/useSearchShouldCalculateTotals'; @@ -53,7 +54,7 @@ import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID'; import getPlatform from '@libs/getPlatform'; import {getExistingTransactionID} from '@libs/IOUUtils'; import Log from '@libs/Log'; -import {getThreadReportIDsForTransactions, getTotalAmountForIOUReportPreviewButton} from '@libs/MoneyRequestReportUtils'; +import {getAllNonDeletedTransactions, getThreadReportIDsForTransactions, getTotalAmountForIOUReportPreviewButton} from '@libs/MoneyRequestReportUtils'; import Navigation from '@libs/Navigation/Navigation'; import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import type {ReportsSplitNavigatorParamList, RightModalNavigatorParamList} from '@libs/Navigation/types'; @@ -68,8 +69,10 @@ import type {KYCFlowEvent, TriggerKYCFlow} from '@libs/PaymentUtils'; import {handleUnvalidatedAccount, selectPaymentType} from '@libs/PaymentUtils'; import {getConnectedIntegration, getValidConnectedIntegration, hasDynamicExternalWorkflow, sortPoliciesByName} from '@libs/PolicyUtils'; import { + getFilteredReportActionsForReportView, getIOUActionForReportID, getIOUActionForTransactionID, + getOneTransactionThreadReportID, getOriginalMessage, getReportAction, hasPendingDEWApprove, @@ -195,21 +198,8 @@ import type {PaymentActionParams} from './SettlementButton/types'; import Text from './Text'; type MoneyReportHeaderProps = { - /** The report currently being looked at */ - report: OnyxEntry; - - /** The policy tied to the expense report */ - policy: OnyxEntry; - - /** Array of report actions for the report */ - reportActions: OnyxTypes.ReportAction[]; - - /** The reportID of the transaction thread report associated with this current report, if any */ - // eslint-disable-next-line react/no-unused-prop-types - transactionThreadReportID: string | undefined; - - /** whether we are loading report data in openReport command */ - isLoadingInitialReportActions?: boolean; + /** The reportID of the report currently being looked at */ + reportID: string | undefined; /** Whether back button should be displayed in header */ shouldDisplayBackButton?: boolean; @@ -218,15 +208,14 @@ type MoneyReportHeaderProps = { onBackButtonPress: () => void; }; -function MoneyReportHeader({ - policy, - report: moneyRequestReport, - transactionThreadReportID, - reportActions, - isLoadingInitialReportActions, - shouldDisplayBackButton = false, - onBackButtonPress, -}: MoneyReportHeaderProps) { +function MoneyReportHeader({reportID: reportIDProp, shouldDisplayBackButton = false, onBackButtonPress}: MoneyReportHeaderProps) { + const [moneyRequestReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportIDProp}`); + const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${getNonEmptyStringOnyxID(moneyRequestReport?.policyID)}`); + const [reportMetadataInternal] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportIDProp}`); + const isLoadingInitialReportActions = reportMetadataInternal?.isLoadingInitialReportActions; + const {reportActions: unfilteredReportActions} = usePaginatedReportActions(moneyRequestReport?.reportID); + const reportActions = getFilteredReportActionsForReportView(unfilteredReportActions); + // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to use a correct layout for the hold expense modal https://github.com/Expensify/App/pull/47990#issuecomment-2362382026 // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth const {shouldUseNarrowLayout, isSmallScreenWidth, isMediumScreenWidth} = useResponsiveLayout(); @@ -245,6 +234,12 @@ function MoneyReportHeader({ const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END); const [userBillingGraceEndPeriods] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${moneyRequestReport?.chatReportID}`); + const {isOffline} = useNetwork(); + const allReportTransactions = useReportTransactionsCollection(reportIDProp); + const nonDeletedTransactions = getAllNonDeletedTransactions(allReportTransactions, reportActions, isOffline, true); + const visibleTransactionsForThreadID = nonDeletedTransactions?.filter((t) => isOffline || t.pendingAction !== 'delete'); + const reportTransactionIDs = visibleTransactionsForThreadID?.map((t) => t.transactionID); + const transactionThreadReportID = getOneTransactionThreadReportID(moneyRequestReport, chatReport, reportActions ?? [], isOffline, reportTransactionIDs); const [nextStep] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${moneyRequestReport?.reportID}`); const [isUserValidated] = useOnyx(ONYXKEYS.ACCOUNT, { selector: isUserValidatedSelector, @@ -407,7 +402,6 @@ function MoneyReportHeader({ usePaymentAnimations(); const styles = useThemeStyles(); const theme = useTheme(); - const {isOffline} = useNetwork(); const {isExpenseSplit} = getOriginalTransactionWithSplitInfo(transaction, originalTransaction); const [allTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION); const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT); diff --git a/src/components/MoneyRequestHeader.tsx b/src/components/MoneyRequestHeader.tsx index f1372d631888d..d3b4a9509f5b5 100644 --- a/src/components/MoneyRequestHeader.tsx +++ b/src/components/MoneyRequestHeader.tsx @@ -5,7 +5,6 @@ import {validTransactionDraftsSelector} from '@selectors/TransactionDraft'; import type {ReactNode} from 'react'; import React, {useCallback, useMemo, useRef, useState} from 'react'; import {View} from 'react-native'; -import type {OnyxEntry} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; import useConfirmModal from '@hooks/useConfirmModal'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; @@ -16,6 +15,7 @@ import useGetIOUReportFromReportAction from '@hooks/useGetIOUReportFromReportAct import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; +import useParentReportAction from '@hooks/useParentReportAction'; import usePermissions from '@hooks/usePermissions'; import usePolicyForMovingExpenses from '@hooks/usePolicyForMovingExpenses'; import useReportIsArchived from '@hooks/useReportIsArchived'; @@ -74,7 +74,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; -import type {Policy, Report, ReportAction, Transaction} from '@src/types/onyx'; +import type {Transaction} from '@src/types/onyx'; import type IconAsset from '@src/types/utils/IconAsset'; import BrokenConnectionDescription from './BrokenConnectionDescription'; import Button from './Button'; @@ -96,20 +96,18 @@ import {useSearchActionsContext, useSearchStateContext} from './Search/SearchCon import {useWideRHPState} from './WideRHPContextProvider'; type MoneyRequestHeaderProps = { - /** The report currently being looked at */ - report: OnyxEntry; - - /** The policy which the report is tied to */ - policy: OnyxEntry; - - /** The report action the transaction is tied to from the parent report */ - parentReportAction: OnyxEntry; + /** The reportID of the report currently being looked at */ + reportID: string | undefined; /** Method to trigger when pressing close button of the header */ onBackButtonPress: (prioritizeBackTo?: boolean) => void; }; -function MoneyRequestHeader({report, parentReportAction, policy, onBackButtonPress}: MoneyRequestHeaderProps) { +function MoneyRequestHeader({reportID: reportIDProp, onBackButtonPress}: MoneyRequestHeaderProps) { + const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportIDProp}`); + const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${getNonEmptyStringOnyxID(report?.policyID)}`); + const parentReportAction = useParentReportAction(report); + // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to use a correct layout for the hold expense modal https://github.com/Expensify/App/pull/47990#issuecomment-2362382026 // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth const {shouldUseNarrowLayout, isSmallScreenWidth, isInNarrowPaneModal} = useResponsiveLayout(); diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportView.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportView.tsx index b5a38c5bd190f..5f78aea26c5db 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportView.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportView.tsx @@ -180,9 +180,7 @@ function MoneyRequestReportView({report, policy, reportMetadata, shouldDisplayRe () => isTransactionThreadView ? ( { if (!backToRoute) { goBackFromSearchMoneyRequest(); @@ -193,11 +191,7 @@ function MoneyRequestReportView({report, policy, reportMetadata, shouldDisplayRe /> ) : ( { if (!backToRoute) { @@ -208,7 +202,7 @@ function MoneyRequestReportView({report, policy, reportMetadata, shouldDisplayRe }} /> ), - [backToRoute, isLoadingInitialReportActions, isTransactionThreadView, parentReportAction, policy, report, reportActions, transactionThreadReportID], + [backToRoute, isTransactionThreadView, report?.reportID], ); // We need to cancel telemetry span when user leaves the screen before full report data is loaded diff --git a/src/pages/Search/SearchMoneyRequestReportPage.tsx b/src/pages/Search/SearchMoneyRequestReportPage.tsx index 690565e2ffb76..3fdccb5a62344 100644 --- a/src/pages/Search/SearchMoneyRequestReportPage.tsx +++ b/src/pages/Search/SearchMoneyRequestReportPage.tsx @@ -133,19 +133,6 @@ function SearchMoneyRequestReportPage({route}: SearchMoneyRequestPageProps) { }); }, [isFocused, deleteTransactionNavigateBackUrl]); - const snapshotReport = useMemo(() => { - // eslint-disable-next-line @typescript-eslint/no-deprecated - return (snapshot?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${reportIDFromRoute}`] ?? {}) as typeof report; - }, [snapshot, reportIDFromRoute]); - - // Use snapshot report currency if main collection doesn't have it (for offline mode) - const reportToUse = useMemo(() => { - if (!report) { - return report; - } - return {...report, currency: report.currency ?? snapshotReport?.currency}; - }, [report, snapshotReport?.currency]); - const [reportMetadata = defaultReportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportIDFromRoute}`); const [policies = getEmptyObject>>()] = useOnyx(ONYXKEYS.COLLECTION.POLICY); const policy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]; @@ -428,7 +415,7 @@ function SearchMoneyRequestReportPage({route}: SearchMoneyRequestPageProps) { > void; - /** The report currently being looked at */ - report: OnyxEntry; - - /** The report action the transaction is tied to from the parent report */ - parentReportAction: OnyxEntry | null; - /** The reportID of the current report */ reportID: string | undefined; - - /** Whether we should display the header as in narrow layout */ - shouldUseNarrowLayout?: boolean; }; -function HeaderView({report, parentReportAction, onNavigationMenuButtonClicked, shouldUseNarrowLayout = false}: HeaderViewProps) { +function HeaderView({onNavigationMenuButtonClicked, reportID}: HeaderViewProps) { + const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`); + const parentReportAction = useParentReportAction(report); + const icons = useMemoizedLazyExpensifyIcons(['BackArrow', 'Close', 'DotIndicator'] as const); // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth - const {isSmallScreenWidth} = useResponsiveLayout(); + const {isSmallScreenWidth, shouldUseNarrowLayout} = useResponsiveLayout(); const isInSidePanel = useIsInSidePanel(); const route = useRoute(); const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(report?.parentReportID) ?? getNonEmptyStringOnyxID(report?.reportID)}`); diff --git a/src/pages/inbox/ReportScreen.tsx b/src/pages/inbox/ReportScreen.tsx index 200bc5ce11477..ad8dca6031844 100644 --- a/src/pages/inbox/ReportScreen.tsx +++ b/src/pages/inbox/ReportScreen.tsx @@ -409,9 +409,7 @@ function ReportScreen({route, navigation}: ReportScreenProps) { if (isTransactionThreadView) { return ( ); @@ -420,11 +418,7 @@ function ReportScreen({route, navigation}: ReportScreenProps) { if (isMoneyRequestOrInvoiceReport) { return ( ); @@ -434,24 +428,9 @@ function ReportScreen({route, navigation}: ReportScreenProps) { ); - }, [ - isTransactionThreadView, - isMoneyRequestOrInvoiceReport, - report, - policy, - parentReportAction, - onBackButtonPress, - transactionThreadReportID, - reportMetadata.isLoadingInitialReportActions, - reportActions, - reportIDFromRoute, - shouldUseNarrowLayout, - ]); + }, [isTransactionThreadView, isMoneyRequestOrInvoiceReport, onBackButtonPress, reportIDFromRoute]); useEffect(() => { if (!transactionThreadReportID || !route?.params?.reportActionID || !isOneTransactionThread(childReport, report, linkedAction)) { diff --git a/src/pages/inbox/report/ReportFooter.tsx b/src/pages/inbox/report/ReportFooter.tsx index bab9c20404680..ee338f26f616e 100644 --- a/src/pages/inbox/report/ReportFooter.tsx +++ b/src/pages/inbox/report/ReportFooter.tsx @@ -22,7 +22,6 @@ import useReportIsArchived from '@hooks/useReportIsArchived'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useShortMentionsList from '@hooks/useShortMentionsList'; import useThemeStyles from '@hooks/useThemeStyles'; -import useWindowDimensions from '@hooks/useWindowDimensions'; import {addComment} from '@libs/actions/Report'; import {createTaskAndNavigate, setNewOptimisticAssignee} from '@libs/actions/Task'; import {isEmailPublicDomain} from '@libs/LoginUtils'; @@ -37,7 +36,6 @@ import { isSystemChat as isSystemChatUtil, } from '@libs/ReportUtils'; import {generateAccountID} from '@libs/UserUtils'; -import variables from '@styles/variables'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type * as OnyxTypes from '@src/types/onyx'; @@ -85,7 +83,6 @@ function ReportFooter({ const styles = useThemeStyles(); const {isOffline} = useNetwork(); const {translate} = useLocalize(); - const {windowWidth} = useWindowDimensions(); const isInSidePanel = useIsInSidePanel(); // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth const {isSmallScreenWidth, shouldUseNarrowLayout} = useResponsiveLayout(); @@ -113,8 +110,6 @@ function ReportFooter({ const ancestors = useAncestors(report); const isArchivedRoom = isArchivedNonExpenseReport(report, isReportArchived); - const isSmallSizeLayout = windowWidth - (shouldUseNarrowLayout ? 0 : variables.sideBarWithLHBWidth) < variables.anonymousReportFooterBreakpoint; - // If a user just signed in and is viewing a public report, optimistically show the composer while loading the report, since they will have write access when the response comes back. const shouldShowComposerOptimistically = !isAnonymousUser && isPublicRoom(report) && !!isLoadingInitialReportActions; const canPerformWriteAction = canUserPerformWriteAction(report, isReportArchived) ?? shouldShowComposerOptimistically; @@ -222,18 +217,8 @@ function ReportFooter({ shouldUseNarrowLayout ? styles.mb5 : null, ]} > - {isAnonymousUser && !isArchivedRoom && ( - - )} - {isArchivedRoom && ( - - )} + {isAnonymousUser && !isArchivedRoom && } + {isArchivedRoom && } {!isArchivedRoom && !!isBlockedFromChat && } {!isAnonymousUser && !canWriteInReport && isSystemChat && } {isAdminsOnlyPostingRoom && !isUserPolicyAdmin && !isArchivedRoom && !isAnonymousUser && !isBlockedFromChat && ( diff --git a/tests/ui/components/HeaderViewTest.tsx b/tests/ui/components/HeaderViewTest.tsx index ff2de6b5ef5e5..0c6fada15d3a2 100644 --- a/tests/ui/components/HeaderViewTest.tsx +++ b/tests/ui/components/HeaderViewTest.tsx @@ -50,7 +50,7 @@ describe('HeaderView', () => { }); beforeAll(() => { - Onyx.init({keys: ONYXKEYS}); + Onyx.init({keys: ONYXKEYS, evictableKeys: [ONYXKEYS.COLLECTION.REPORT_ACTIONS]}); initOnyxDerivedValues(); return waitForBatchedUpdates(); }); @@ -82,9 +82,7 @@ describe('HeaderView', () => { {}} - parentReportAction={null} reportID={report.reportID} /> @@ -117,14 +115,14 @@ describe('HeaderView', () => { notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, }; + await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report); + await waitForBatchedUpdates(); + render( {}} - parentReportAction={null} reportID={report.reportID} - shouldUseNarrowLayout /> , ); @@ -178,9 +176,7 @@ describe('HeaderView', () => { {}} - parentReportAction={parentReportAction} reportID={threadReport.reportID} />