Skip to content

Commit fa07c33

Browse files
adamgrzybowskiWojtekBoman
authored andcommitted
fix going back IOU for default workspace
1 parent c5b6b49 commit fa07c33

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/pages/iou/request/step/IOURequestStepConfirmation.tsx

+14-5
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,22 @@ function IOURequestStepConfirmation({
216216
Navigation.goBack(ROUTES.MONEY_REQUEST_STEP_SUBRATE.getRoute(action, iouType, transactionID, reportID));
217217
return;
218218
}
219-
// If there is not a report attached to the IOU with a reportID, then the participants were manually selected and the user needs taken
220-
// back to the participants step
221-
if ((!transaction?.participantsAutoAssigned && participantsAutoAssignedFromRoute !== 'true') || transaction?.isFromGlobalCreate) {
222-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
223-
Navigation.goBack(ROUTES.MONEY_REQUEST_STEP_PARTICIPANTS.getRoute(iouType, transactionID, transaction?.reportID || reportID, undefined, action), {compareParams: false});
219+
220+
if (transaction?.isFromGlobalCreate) {
221+
// If the participants weren't automatically added to the transaction, then we should go back to the IOURequestStepParticipants.
222+
if (!transaction?.participantsAutoAssigned && participantsAutoAssignedFromRoute !== 'true') {
223+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
224+
Navigation.goBack(ROUTES.MONEY_REQUEST_STEP_PARTICIPANTS.getRoute(iouType, transactionID, transaction?.reportID || reportID, undefined, action), {compareParams: false});
225+
return;
226+
}
227+
228+
// If the participant was auto-assigned, we need to keep the reportID that is already on the stack.
229+
// This will allow the user to edit the participant field after going back and forward.
230+
Navigation.goBack();
224231
return;
225232
}
233+
234+
// This has selected the participants from the beginning and the participant field shouldn't be editable.
226235
navigateToStartMoneyRequestStep(requestType, iouType, transactionID, reportID, action);
227236
}, [
228237
action,

0 commit comments

Comments
 (0)