Skip to content
10 changes: 9 additions & 1 deletion src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7215,7 +7215,15 @@ function payInvoice(paymentMethodType: PaymentMethodType, chatReport: OnyxTypes.

function detachReceipt(transactionID: string) {
const transaction = allTransactions[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`];
const newTransaction = transaction ? {...transaction, filename: '', receipt: {}} : null;
const newTransaction = transaction
? {
...transaction,
filename: '',
receipt: {
source: '',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not resetting the receipt here caused an issue as mentioned in PR here. And we fixed this in the same PR

},
}
: null;

const optimisticData: OnyxUpdate[] = [
{
Expand Down
11 changes: 9 additions & 2 deletions src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -558,15 +558,22 @@ function ReportScreen({

// If a user has chosen to leave a thread, and then returns to it (e.g. with the back button), we need to call `openReport` again in order to allow the user to rejoin and to receive real-time updates
useEffect(() => {
if (!shouldUseNarrowLayout || !isFocused || prevIsFocused || !ReportUtils.isChatThread(report) || report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) {
if (
!shouldUseNarrowLayout ||
!isFocused ||
prevIsFocused ||
!ReportUtils.isChatThread(report) ||
report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN ||
isSingleTransactionView
) {
return;
}
Report.openReport(report.reportID);

// We don't want to run this useEffect every time `report` is changed
// Excluding shouldUseNarrowLayout from the dependency list to prevent re-triggering on screen resize events.
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [prevIsFocused, report.notificationPreference, isFocused]);
}, [prevIsFocused, report.notificationPreference, isFocused, isSingleTransactionView]);

useEffect(() => {
// We don't want this effect to run on the first render.
Expand Down