diff --git a/src/components/SelectionList/ChatListItem.tsx b/src/components/SelectionList/ChatListItem.tsx index f4bc5893326f..81f2fb1311c8 100644 --- a/src/components/SelectionList/ChatListItem.tsx +++ b/src/components/SelectionList/ChatListItem.tsx @@ -81,6 +81,7 @@ function ChatListItem({ index={item.index ?? 0} isFirstVisibleReportAction={false} shouldDisplayContextMenu={false} + shouldShowDraftMessage={false} shouldShowSubscriptAvatar={ (isPolicyExpenseChat(report) || isInvoiceRoom(report)) && [ diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 34cfee29ac2d..7937655752ad 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -33,7 +33,12 @@ import type {ReportAction} from '@src/types/onyx'; import type {PureReportActionItemProps} from './PureReportActionItem'; import PureReportActionItem from './PureReportActionItem'; -function ReportActionItem({action, report, ...props}: PureReportActionItemProps) { +type ReportActionItemProps = PureReportActionItemProps & { + /** Whether to show the draft message or not */ + shouldShowDraftMessage?: boolean; +}; + +function ReportActionItem({action, report, shouldShowDraftMessage = true, ...props}: ReportActionItemProps) { const reportID = report?.reportID; // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const originalReportID = useMemo(() => getOriginalReportID(reportID, action), [reportID, action]); @@ -42,6 +47,9 @@ function ReportActionItem({action, report, ...props}: PureReportActionItemProps) const [draftMessage] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${originalReportID}`, { canBeMissing: true, selector: (draftMessagesForReport) => { + if (!shouldShowDraftMessage) { + return undefined; + } const matchingDraftMessage = draftMessagesForReport?.[action.reportActionID]; return typeof matchingDraftMessage === 'string' ? matchingDraftMessage : matchingDraftMessage?.message; },