From f13c27e883f6dfe9b4154b6f1d337f20775acaa2 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Wed, 5 Jun 2024 18:05:12 +0200 Subject: [PATCH] fix: ReportScreen null values --- src/components/HeaderWithBackButton/types.ts | 2 +- src/components/MoneyReportHeader.tsx | 2 +- src/components/MoneyRequestHeader.tsx | 4 +- src/libs/PolicyUtils.ts | 10 ++--- src/libs/ReportActionsUtils.ts | 2 +- src/libs/ReportUtils.ts | 40 +++++++++---------- src/libs/actions/IOU.ts | 14 +++++-- src/pages/home/HeaderView.tsx | 2 +- src/pages/home/ReportScreen.tsx | 10 ++--- .../ComposerWithSuggestions.tsx | 2 +- src/pages/home/report/ReportActionItem.tsx | 2 +- .../report/ReportActionItemParentAction.tsx | 2 +- src/pages/home/report/ReportActionsList.tsx | 2 +- .../report/ReportActionsListItemRenderer.tsx | 2 +- src/pages/home/report/ReportActionsView.tsx | 2 +- src/pages/home/report/ReportFooter.tsx | 2 +- 16 files changed, 54 insertions(+), 46 deletions(-) diff --git a/src/components/HeaderWithBackButton/types.ts b/src/components/HeaderWithBackButton/types.ts index 6b08dd74dc8b..1f6b92099e59 100644 --- a/src/components/HeaderWithBackButton/types.ts +++ b/src/components/HeaderWithBackButton/types.ts @@ -102,7 +102,7 @@ type HeaderWithBackButtonProps = Partial & { report?: OnyxEntry; /** The report's policy, if we're showing the details for a report and need info about it for AvatarWithDisplay */ - policy?: OnyxEntry; + policy?: OnyxEntry | null; /** Single execution function to prevent concurrent navigation actions */ singleExecution?: (action: Action) => Action; diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index ec52a6158ad7..538e0454a535 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -35,7 +35,7 @@ type MoneyReportHeaderProps = { report: OnyxTypes.Report; /** The policy tied to the expense report */ - policy: OnyxEntry; + policy: OnyxEntry | null; /** Array of report actions for the report */ reportActions: OnyxTypes.ReportAction[]; diff --git a/src/components/MoneyRequestHeader.tsx b/src/components/MoneyRequestHeader.tsx index abd70753b461..9dc298ba9661 100644 --- a/src/components/MoneyRequestHeader.tsx +++ b/src/components/MoneyRequestHeader.tsx @@ -35,10 +35,10 @@ type MoneyRequestHeaderProps = { report: Report; /** The policy which the report is tied to */ - policy: OnyxEntry; + policy: OnyxEntry | null; /** The report action the transaction is tied to from the parent report */ - parentReportAction: OnyxEntry; + parentReportAction: OnyxEntry | null; /** Whether we should display the header as in narrow layout */ shouldUseNarrowLayout?: boolean; diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 7487e1fd5146..c1d299743a08 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -6,7 +6,7 @@ import type {SelectorType} from '@components/SelectionScreen'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import type {Policy, PolicyCategories, PolicyEmployeeList, PolicyTagList, PolicyTags, TaxRate} from '@src/types/onyx'; +import type {OnyxInputOrEntry, Policy, PolicyCategories, PolicyEmployeeList, PolicyTagList, PolicyTags, TaxRate} from '@src/types/onyx'; import type {PolicyFeatureName, Rate, Tenant} from '@src/types/onyx/Policy'; import type PolicyEmployee from '@src/types/onyx/PolicyEmployee'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; @@ -142,7 +142,7 @@ function isExpensifyTeam(email: string | undefined): boolean { /** * Checks if the current user is an admin of the policy. */ -const isPolicyAdmin = (policy: OnyxEntry | EmptyObject, currentUserLogin?: string): boolean => +const isPolicyAdmin = (policy: OnyxInputOrEntry | EmptyObject, currentUserLogin?: string): boolean => (policy?.role ?? (currentUserLogin && policy?.employeeList?.[currentUserLogin]?.role)) === CONST.POLICY.ROLE.ADMIN; /** @@ -155,7 +155,7 @@ const isPolicyEmployee = (policyID: string, policies: OnyxCollection): b /** * Checks if the current user is an owner (creator) of the policy. */ -const isPolicyOwner = (policy: OnyxEntry | EmptyObject, currentUserAccountID: number): boolean => policy?.ownerAccountID === currentUserAccountID; +const isPolicyOwner = (policy: OnyxInputOrEntry | EmptyObject, currentUserAccountID: number): boolean => policy?.ownerAccountID === currentUserAccountID; /** * Create an object mapping member emails to their accountIDs. Filter for members without errors if includeMemberWithErrors is false, and get the login email from the personalDetail object using the accountID. @@ -297,14 +297,14 @@ function isTaxTrackingEnabled(isPolicyExpenseChat: boolean, policy: OnyxEntry | EmptyObject): boolean { +function isInstantSubmitEnabled(policy: OnyxInputOrEntry | EmptyObject): boolean { return policy?.type === CONST.POLICY.TYPE.FREE || (policy?.autoReporting === true && policy?.autoReportingFrequency === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.INSTANT); } /** * Checks if policy's approval mode is "optional", a.k.a. "Submit & Close" */ -function isSubmitAndClose(policy: OnyxEntry | EmptyObject): boolean { +function isSubmitAndClose(policy: OnyxInputOrEntry | EmptyObject): boolean { return policy?.approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL; } diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index d5b13b8f36cc..782d3daffaa1 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -239,7 +239,7 @@ function isSentMoneyReportAction(reportAction: OnyxEntry | EmptyObject): boolean { +function isTransactionThread(parentReportAction: OnyxInputOrEntry | EmptyObject): boolean { return ( parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && (parentReportAction.originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.CREATE || diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 1e68a5eb24bc..70f02291bc69 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -668,7 +668,7 @@ function getPolicy(policyID: string | undefined): Policy | EmptyObject { * Get the policy type from a given report * @param policies must have Onyxkey prefix (i.e 'policy_') for keys */ -function getPolicyType(report: OnyxEntry, policies: OnyxCollection): string { +function getPolicyType(report: OnyxInputOrEntry, policies: OnyxCollection): string { return policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.type ?? ''; } @@ -711,7 +711,7 @@ function isChatReport(report: OnyxEntry | EmptyObject): boolean { return report?.type === CONST.REPORT.TYPE.CHAT; } -function isInvoiceReport(report: OnyxEntry | EmptyObject): boolean { +function isInvoiceReport(report: OnyxInputOrEntry | EmptyObject): boolean { return report?.type === CONST.REPORT.TYPE.INVOICE; } @@ -725,7 +725,7 @@ function isExpenseReport(report: OnyxInputOrEntry | EmptyObject): boolea /** * Checks if a report is an IOU report using report or reportID */ -function isIOUReport(reportOrID: OnyxEntry | string | EmptyObject): boolean { +function isIOUReport(reportOrID: OnyxInputOrEntry | string | EmptyObject): boolean { const report = typeof reportOrID === 'string' ? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportOrID}`] ?? null : reportOrID; return report?.type === CONST.REPORT.TYPE.IOU; } @@ -739,7 +739,7 @@ function isIOUReportUsingReport(report: OnyxEntry | EmptyObject): report /** * Checks if a report is a task report. */ -function isTaskReport(report: OnyxEntry): boolean { +function isTaskReport(report: OnyxInputOrEntry): boolean { return report?.type === CONST.REPORT.TYPE.TASK; } @@ -750,7 +750,7 @@ function isTaskReport(report: OnyxEntry): boolean { * There's another situation where you don't have access to the parentReportAction (because it was created in a chat you don't have access to) * In this case, we have added the key to the report itself */ -function isCanceledTaskReport(report: OnyxEntry | EmptyObject = {}, parentReportAction: OnyxEntry | EmptyObject = {}): boolean { +function isCanceledTaskReport(report: OnyxInputOrEntry | EmptyObject = {}, parentReportAction: OnyxInputOrEntry | EmptyObject = {}): boolean { if (!isEmptyObject(parentReportAction) && (parentReportAction?.message?.[0]?.isDeletedParentAction ?? false)) { return true; } @@ -767,7 +767,7 @@ function isCanceledTaskReport(report: OnyxEntry | EmptyObject = {}, pare * * @param parentReportAction - The parent report action of the report (Used to check if the task has been canceled) */ -function isOpenTaskReport(report: OnyxEntry, parentReportAction: OnyxEntry | EmptyObject = {}): boolean { +function isOpenTaskReport(report: OnyxInputOrEntry, parentReportAction: OnyxInputOrEntry | EmptyObject = {}): boolean { return ( isTaskReport(report) && !isCanceledTaskReport(report, parentReportAction) && report?.stateNum === CONST.REPORT.STATE_NUM.OPEN && report?.statusNum === CONST.REPORT.STATUS_NUM.OPEN ); @@ -790,7 +790,7 @@ function isReportManager(report: OnyxEntry): boolean { /** * Checks if the supplied report has been approved */ -function isReportApproved(reportOrID: OnyxEntry | string | EmptyObject): boolean { +function isReportApproved(reportOrID: OnyxInputOrEntry | string | EmptyObject): boolean { const report = typeof reportOrID === 'string' ? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportOrID}`] ?? null : reportOrID; return report?.stateNum === CONST.REPORT.STATE_NUM.APPROVED && report?.statusNum === CONST.REPORT.STATUS_NUM.APPROVED; } @@ -798,7 +798,7 @@ function isReportApproved(reportOrID: OnyxEntry | string | EmptyObject): /** * Checks if the supplied report is an expense report in Open state and status. */ -function isOpenExpenseReport(report: OnyxEntry | EmptyObject): boolean { +function isOpenExpenseReport(report: OnyxInputOrEntry | EmptyObject): boolean { return isExpenseReport(report) && report?.stateNum === CONST.REPORT.STATE_NUM.OPEN && report?.statusNum === CONST.REPORT.STATUS_NUM.OPEN; } @@ -898,7 +898,7 @@ function isUserCreatedPolicyRoom(report: OnyxEntry): boolean { /** * Whether the provided report is a Policy Expense chat. */ -function isPolicyExpenseChat(report: OnyxEntry | Participant | EmptyObject): boolean { +function isPolicyExpenseChat(report: OnyxInputOrEntry | Participant | EmptyObject): boolean { return getChatType(report) === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT || (report?.isPolicyExpenseChat ?? false); } @@ -938,7 +938,7 @@ function isGroupPolicy(policyType: string): boolean { /** * Whether the provided report belongs to a Free, Collect or Control policy */ -function isReportInGroupPolicy(report: OnyxEntry, policy?: OnyxEntry): boolean { +function isReportInGroupPolicy(report: OnyxInputOrEntry, policy?: OnyxInputOrEntry): boolean { const policyType = policy?.type ?? getPolicyType(report, allPolicies); return isGroupPolicy(policyType); } @@ -1244,7 +1244,7 @@ function isClosedExpenseReportWithNoExpenses(report: OnyxEntry): boolean /** * Whether the provided report is an archived room */ -function isArchivedRoom(report: OnyxEntry | EmptyObject, reportNameValuePairs?: OnyxEntry | EmptyObject): boolean { +function isArchivedRoom(report: OnyxInputOrEntry | EmptyObject, reportNameValuePairs?: OnyxInputOrEntry | EmptyObject): boolean { if (reportNameValuePairs) { return reportNameValuePairs.isArchived; } @@ -1422,7 +1422,7 @@ function isMoneyRequest(reportOrID: OnyxEntry | string): boolean { /** * Checks if a report is an IOU or expense report. */ -function isMoneyRequestReport(reportOrID: OnyxEntry | EmptyObject | string): boolean { +function isMoneyRequestReport(reportOrID: OnyxInputOrEntry | EmptyObject | string): boolean { const report = typeof reportOrID === 'object' ? reportOrID : allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportOrID}`] ?? undefined; return isIOUReport(report) || isExpenseReport(report); } @@ -2347,7 +2347,7 @@ function hasNonReimbursableTransactions(iouReportID: string | undefined): boolea return transactions.filter((transaction) => transaction.reimbursable === false).length > 0; } -function getMoneyRequestSpendBreakdown(report: OnyxEntry, allReportsDict?: OnyxCollection): SpendBreakdown { +function getMoneyRequestSpendBreakdown(report: OnyxInputOrEntry, allReportsDict?: OnyxCollection): SpendBreakdown { const allAvailableReports = allReportsDict ?? allReports; let moneyRequestReport; if (isMoneyRequestReport(report) || isInvoiceReport(report)) { @@ -2728,7 +2728,7 @@ function canEditFieldOfMoneyRequest(reportAction: OnyxEntry, field * - It's an expense where conditions for editability are defined in canEditMoneyRequest method * - It's not pending deletion */ -function canEditReportAction(reportAction: OnyxEntry): boolean { +function canEditReportAction(reportAction: OnyxInputOrEntry): boolean { const isCommentOrIOU = reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT || reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU; return Boolean( @@ -6390,7 +6390,7 @@ function shouldDisplayThreadReplies(reportAction: OnyxEntry, repor /** * Check if money report has any transactions updated optimistically */ -function hasUpdatedTotal(report: OnyxEntry, policy: OnyxEntry): boolean { +function hasUpdatedTotal(report: OnyxInputOrEntry, policy: OnyxInputOrEntry): boolean { if (!report) { return true; } @@ -6406,7 +6406,7 @@ function hasUpdatedTotal(report: OnyxEntry, policy: OnyxEntry): /** * Return held and full amount formatted with used currency */ -function getNonHeldAndFullAmount(iouReport: OnyxEntry, policy: OnyxEntry): string[] { +function getNonHeldAndFullAmount(iouReport: OnyxInputOrEntry, policy: OnyxInputOrEntry): string[] { const transactions = TransactionUtils.getAllReportTransactions(iouReport?.reportID ?? ''); const hasPendingTransaction = transactions.some((transaction) => !!transaction.pendingAction); @@ -6560,7 +6560,7 @@ function getOptimisticDataForParentReportAction(reportID: string, lastVisibleAct }); } -function canBeAutoReimbursed(report: OnyxEntry, policy: OnyxEntry | EmptyObject): boolean { +function canBeAutoReimbursed(report: OnyxInputOrEntry, policy: OnyxInputOrEntry | EmptyObject): boolean { if (isEmptyObject(policy)) { return false; } @@ -6577,7 +6577,7 @@ function canBeAutoReimbursed(report: OnyxEntry, policy: OnyxEntry): boolean { +function isReportOwner(report: OnyxInputOrEntry): boolean { return report?.ownerAccountID === currentUserPersonalDetails?.accountID; } @@ -6647,14 +6647,14 @@ function hasActionsWithErrors(reportID: string): boolean { return Object.values(reportActions).some((action) => !isEmptyObject(action.errors)); } -function isNonAdminOrOwnerOfPolicyExpenseChat(report: OnyxEntry, policy: OnyxEntry): boolean { +function isNonAdminOrOwnerOfPolicyExpenseChat(report: OnyxInputOrEntry, policy: OnyxInputOrEntry): boolean { return isPolicyExpenseChat(report) && !(PolicyUtils.isPolicyAdmin(policy) || PolicyUtils.isPolicyOwner(policy, currentUserAccountID ?? -1) || isReportOwner(report)); } /** * Whether the user can join a report */ -function canJoinChat(report: OnyxEntry, parentReportAction: OnyxEntry, policy: OnyxEntry): boolean { +function canJoinChat(report: OnyxInputOrEntry, parentReportAction: OnyxInputOrEntry, policy: OnyxInputOrEntry): boolean { // We disabled thread functions for whisper action // So we should not show join option for existing thread on whisper message that has already been left, or manually leave it if (ReportActionsUtils.isWhisperAction(parentReportAction)) { diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index a7bccc7c80f7..661671f4f692 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -1,7 +1,7 @@ import {format} from 'date-fns'; import fastMerge from 'expensify-common/lib/fastMerge'; import Str from 'expensify-common/lib/str'; -import type {OnyxCollection, OnyxCollectionInput, OnyxEntry, OnyxInputValue, OnyxUpdate} from 'react-native-onyx'; +import type {OnyxCollection, OnyxEntry, OnyxInputValue, OnyxUpdate} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; import ReceiptGeneric from '@assets/images/receipt-generic.png'; @@ -6044,7 +6044,11 @@ function sendMoneyWithWallet(report: OnyxEntry, amount: number Report.notifyNewAction(params.chatReportID, managerID); } -function canApproveIOU(iouReport: OnyxEntry | EmptyObject, chatReport: OnyxEntry | EmptyObject, policy: OnyxEntry | EmptyObject) { +function canApproveIOU( + iouReport: OnyxTypes.OnyxInputOrEntry | EmptyObject, + chatReport: OnyxTypes.OnyxInputOrEntry | EmptyObject, + policy: OnyxTypes.OnyxInputOrEntry | EmptyObject, +) { if (isEmptyObject(chatReport)) { return false; } @@ -6071,7 +6075,11 @@ function canApproveIOU(iouReport: OnyxEntry | EmptyObject, cha return isCurrentUserManager && !isOpenExpenseReport && !isApproved && !iouSettled && !isArchivedReport; } -function canIOUBePaid(iouReport: OnyxEntry | EmptyObject, chatReport: OnyxEntry | EmptyObject, policy: OnyxEntry | EmptyObject) { +function canIOUBePaid( + iouReport: OnyxTypes.OnyxInputOrEntry | EmptyObject, + chatReport: OnyxTypes.OnyxInputOrEntry | EmptyObject, + policy: OnyxTypes.OnyxInputOrEntry | EmptyObject, +) { const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(chatReport); const isChatReportArchived = ReportUtils.isArchivedRoom(chatReport); const iouSettled = ReportUtils.isSettled(iouReport?.reportID); diff --git a/src/pages/home/HeaderView.tsx b/src/pages/home/HeaderView.tsx index db7a4af0c0cb..22a104984f2c 100644 --- a/src/pages/home/HeaderView.tsx +++ b/src/pages/home/HeaderView.tsx @@ -62,7 +62,7 @@ type HeaderViewProps = HeaderViewOnyxProps & { report: OnyxTypes.Report; /** The report action the transaction is tied to from the parent report */ - parentReportAction: OnyxEntry; + parentReportAction: OnyxEntry | null; /** The reportID of the current report */ reportID: string; diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index 38899fc013f7..b8f3fd4f03f3 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -102,9 +102,9 @@ function isEmpty(report: OnyxTypes.Report): boolean { return !Object.values(report).some((value) => value !== undefined && value !== ''); } -function getParentReportAction(parentReportActions: OnyxEntry, parentReportActionID: string | undefined): OnyxEntry { +function getParentReportAction(parentReportActions: OnyxEntry, parentReportActionID: string | undefined): OnyxEntry | null { if (!parentReportActions || !parentReportActionID) { - return; + return null; } return parentReportActions[parentReportActionID ?? '0']; } @@ -290,15 +290,15 @@ function ReportScreen({ const hasHelpfulErrors = Object.keys(report?.errorFields ?? {}).some((key) => key !== 'notFound'); const shouldHideReport = !hasHelpfulErrors && !ReportUtils.canAccessReport(report, policies, betas); - const lastReportAction: OnyxEntry = useMemo( + const lastReportAction: OnyxEntry | null = useMemo( () => reportActions.length ? [...reportActions, parentReportAction].find((action) => ReportUtils.canEditReportAction(action) && !ReportActionsUtils.isMoneyRequestAction(action)) - : undefined, + : null, [reportActions, parentReportAction], ); const isSingleTransactionView = ReportUtils.isMoneyRequest(report) || ReportUtils.isTrackExpenseReport(report); - const policy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`]; + const policy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`] ?? null; const isTopMostReportId = currentReportID === reportIDFromRoute; const didSubscribeToReportLeavingEvents = useRef(false); diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 2a461c1c012a..6224532d66e5 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -157,7 +157,7 @@ type ComposerWithSuggestionsProps = ComposerWithSuggestionsOnyxProps & isEmptyChat?: boolean; /** The last report action */ - lastReportAction?: OnyxEntry; + lastReportAction?: OnyxEntry | null; /** Whether to include chronos */ includeChronos?: boolean; diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 366dbd25ae1c..b645f6410051 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -125,7 +125,7 @@ type ReportActionItemProps = { reportActions: OnyxTypes.ReportAction[]; /** Report action belonging to the report's parent */ - parentReportAction: OnyxEntry; + parentReportAction: OnyxEntry | null; /** The transaction thread report's parentReportAction */ /** It's used by withOnyx HOC */ diff --git a/src/pages/home/report/ReportActionItemParentAction.tsx b/src/pages/home/report/ReportActionItemParentAction.tsx index e97c51377476..13e807d93903 100644 --- a/src/pages/home/report/ReportActionItemParentAction.tsx +++ b/src/pages/home/report/ReportActionItemParentAction.tsx @@ -38,7 +38,7 @@ type ReportActionItemParentActionProps = { reportActions: OnyxTypes.ReportAction[]; /** Report actions belonging to the report's parent */ - parentReportAction: OnyxEntry; + parentReportAction: OnyxEntry | null; /** Whether we should display "Replies" divider */ shouldDisplayReplyDivider: boolean; diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index c700fea4fb85..6378c4bacfeb 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -48,7 +48,7 @@ type ReportActionsListProps = WithCurrentUserPersonalDetailsProps & { reportActions: OnyxTypes.ReportAction[]; /** The report's parentReportAction */ - parentReportAction: OnyxEntry; + parentReportAction: OnyxEntry | null; /** The transaction thread report's parentReportAction */ parentReportActionForTransactionThread: OnyxEntry; diff --git a/src/pages/home/report/ReportActionsListItemRenderer.tsx b/src/pages/home/report/ReportActionsListItemRenderer.tsx index 18118e48f7cb..303dfc4a4bd2 100644 --- a/src/pages/home/report/ReportActionsListItemRenderer.tsx +++ b/src/pages/home/report/ReportActionsListItemRenderer.tsx @@ -15,7 +15,7 @@ type ReportActionsListItemRendererProps = { reportActions: ReportAction[]; /** The report's parentReportAction */ - parentReportAction: OnyxEntry; + parentReportAction: OnyxEntry | null; /** The transaction thread report's parentReportAction */ parentReportActionForTransactionThread: OnyxEntry; diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx index d3eaf9136164..5fd65b6fb6b1 100755 --- a/src/pages/home/report/ReportActionsView.tsx +++ b/src/pages/home/report/ReportActionsView.tsx @@ -53,7 +53,7 @@ type ReportActionsViewProps = ReportActionsViewOnyxProps & { reportActions?: OnyxTypes.ReportAction[]; /** The report's parentReportAction */ - parentReportAction: OnyxEntry; + parentReportAction: OnyxEntry | null; /** The report metadata loading states */ isLoadingInitialReportActions?: boolean; diff --git a/src/pages/home/report/ReportFooter.tsx b/src/pages/home/report/ReportFooter.tsx index ac56fe916bc9..6070a87f8f92 100644 --- a/src/pages/home/report/ReportFooter.tsx +++ b/src/pages/home/report/ReportFooter.tsx @@ -43,7 +43,7 @@ type ReportFooterProps = ReportFooterOnyxProps & { reportNameValuePairs?: OnyxEntry; /** The last report action */ - lastReportAction?: OnyxEntry; + lastReportAction?: OnyxEntry | null; /** Whether the chat is empty */ isEmptyChat?: boolean;