Skip to content

Commit

Permalink
Merge pull request #27793 from aimane-chnaif/revert-26854-request-mon…
Browse files Browse the repository at this point in the history
…ey-link

Revert "Link Request Money not work"

(cherry picked from commit 4969433)
  • Loading branch information
bondydaa authored and OSBotify committed Sep 19, 2023
1 parent d231bd9 commit 5e57333
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/pages/iou/steps/NewRequestAmountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ function NewRequestAmountPage({route, iou, report, selectedTab}) {
// Because we use Onyx to store IOU info, when we try to make two different money requests from different tabs,
// it can result in an IOU sent with improper values. In such cases we want to reset the flow and redirect the user to the first step of the IOU.
useEffect(() => {
const moneyRequestID = `${iouType}${reportID}`;
const shouldReset = iou.id !== moneyRequestID;
if (shouldReset) {
IOU.resetMoneyRequestInfo(moneyRequestID);
}

if (isEditing) {
// ID in Onyx could change by initiating a new request in a separate browser tab or completing a request
if (prevMoneyRequestID.current !== iou.id) {
Expand All @@ -115,6 +109,11 @@ function NewRequestAmountPage({route, iou, report, selectedTab}) {
Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true);
return;
}
const moneyRequestID = `${iouType}${reportID}`;
const shouldReset = iou.id !== moneyRequestID;
if (shouldReset) {
IOU.resetMoneyRequestInfo(moneyRequestID);
}

if (!isDistanceRequestTab && (_.isEmpty(iou.participantAccountIDs) || iou.amount === 0 || shouldReset)) {
Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true);
Expand Down

0 comments on commit 5e57333

Please sign in to comment.