diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportView.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportView.tsx index ec5710093bb3..1457909121a3 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportView.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportView.tsx @@ -246,6 +246,7 @@ function MoneyRequestReportView({report, policy, reportMetadata, shouldDisplayRe isComposerFullSize={!!isComposerFullSize} lastReportAction={lastReportAction} reportTransactions={transactions} + transactionThreadReportID={transactionThreadReportID} /> diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index 7ddeccc863f3..3fe5bd49cf77 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -859,6 +859,7 @@ function ReportScreen({route, navigation}: ReportScreenProps) { isComposerFullSize={!!isComposerFullSize} lastReportAction={lastReportAction} reportTransactions={reportTransactions} + transactionThreadReportID={transactionThreadReportID} /> ) : null} diff --git a/src/pages/home/report/ReportFooter.tsx b/src/pages/home/report/ReportFooter.tsx index 1e7257e7f260..b5ed3c3225db 100644 --- a/src/pages/home/report/ReportFooter.tsx +++ b/src/pages/home/report/ReportFooter.tsx @@ -53,6 +53,9 @@ type ReportFooterProps = { /** Report transactions */ reportTransactions?: OnyxEntry; + /** The ID of the transaction thread report if there is a single transaction */ + transactionThreadReportID?: string; + /** The policy of the report */ policy: OnyxEntry; @@ -86,6 +89,7 @@ function ReportFooter({ onComposerBlur, onComposerFocus, reportTransactions, + transactionThreadReportID, }: ReportFooterProps) { const styles = useThemeStyles(); const {isOffline} = useNetwork(); @@ -175,10 +179,14 @@ function ReportFooter({ if (isTaskCreated) { return; } - addComment(report.reportID, text, true); + + // If we are adding an action on an expense report that only has a single transaction thread child report, we need to add the action to the transaction thread instead. + // This is because we need it to be associated with the transaction thread and not the expense report in order for conversational corrections to work as expected. + const targetReportID = transactionThreadReportID ?? report.reportID; + addComment(targetReportID, text, true); }, // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - [report.reportID, handleCreateTask], + [report.reportID, handleCreateTask, transactionThreadReportID], ); const [didHideComposerInput, setDidHideComposerInput] = useState(!shouldShowComposeInput);