Skip to content
14 changes: 10 additions & 4 deletions src/hooks/useRestartOnReceiptFailure.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
import {useEffect} from 'react';
import type {OnyxEntry} from 'react-native-onyx';
import {checkIfScanFileCanBeRead, setMoneyRequestReceipt} from '@libs/actions/IOU';
import {removeDraftTransactions} from '@libs/actions/TransactionEdit';
import {removeDraftTransactionsByIDs} from '@libs/actions/TransactionEdit';
import {isLocalFile as isLocalFileUtil} from '@libs/fileDownload/FileUtils';
import {navigateToStartMoneyRequestStep} from '@libs/IOUUtils';
import {getRequestType} from '@libs/TransactionUtils';
import type {IOUAction, IOUType} from '@src/CONST';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import {validTransactionDraftIDsSelector} from '@src/selectors/TransactionDraft';
import type {Transaction} from '@src/types/onyx';
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';
import useOnyx from './useOnyx';

const useRestartOnReceiptFailure = (transaction: OnyxEntry<Transaction>, reportID: string, iouType: IOUType, action: IOUAction) => {
const [draftTransactionIDs, draftTransactionsMetadata] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, {selector: validTransactionDraftIDsSelector});

// When the component mounts, if there is a receipt, see if the image can be read from the disk. If not, redirect the user to the starting step of the flow.
// This is because until the request is saved, the receipt file is only stored in the browsers memory as a blob:// and if the browser is refreshed, then
// the image ceases to exist. The best way for the user to recover from this is to start over from the start of the request process.
// skip this in case user is moving the transaction as the receipt path will be valid in that case
useEffect(() => {
let isScanFilesCanBeRead = true;

if (!transaction || action !== CONST.IOU.ACTION.CREATE) {
if (!transaction || action !== CONST.IOU.ACTION.CREATE || isLoadingOnyxValue(draftTransactionsMetadata)) {
return;
}
const itemReceiptFilename = transaction.receipt?.filename;
Expand All @@ -40,13 +46,13 @@ const useRestartOnReceiptFailure = (transaction: OnyxEntry<Transaction>, reportI
return;
}

removeDraftTransactions(true);
removeDraftTransactionsByIDs(draftTransactionIDs, true);
navigateToStartMoneyRequestStep(requestType, iouType, transaction.transactionID, reportID);
});

// We want this hook to run on mounting only
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [draftTransactionsMetadata]);
};

export default useRestartOnReceiptFailure;
8 changes: 4 additions & 4 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
import {openUnreportedExpense} from './actions/Report';
import type {GuidedSetupData, TaskForParameters} from './actions/Report';
import {isAnonymousUser as isAnonymousUserSession} from './actions/Session';
import {removeDraftTransactions} from './actions/TransactionEdit';
import {removeDraftTransactionsByIDs} from './actions/TransactionEdit';
import {getOnboardingMessages} from './actions/Welcome/OnboardingFlow';
import type {OnboardingCompanySize, OnboardingMessage, OnboardingPurpose, OnboardingTaskLinks} from './actions/Welcome/OnboardingFlow';
import type {AddCommentOrAttachmentParams} from './API/parameters';
Expand Down Expand Up @@ -1051,7 +1051,7 @@
};

let conciergeReportIDOnyxConnect: OnyxEntry<string>;
Onyx.connect({

Check warning on line 1054 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportIDOnyxConnect = value;
Expand All @@ -1059,7 +1059,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 1062 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -1077,7 +1077,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 1080 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
if (currentUserAccountID) {
Expand All @@ -1089,7 +1089,7 @@
});

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 1092 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
Expand All @@ -1097,7 +1097,7 @@

let allPolicies: OnyxCollection<Policy>;
let policiesArray: Policy[] = [];
Onyx.connect({

Check warning on line 1100 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1107,7 +1107,7 @@
});

let allPolicyDrafts: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 1110 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_DRAFTS,
waitForCollectionCallback: true,
callback: (value) => (allPolicyDrafts = value),
Expand All @@ -1115,7 +1115,7 @@

let allReports: OnyxCollection<Report>;
let reportsByPolicyID: ReportByPolicyMap;
Onyx.connect({

Check warning on line 1118 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -1151,14 +1151,14 @@
});

let betaConfiguration: OnyxEntry<BetaConfiguration> = {};
Onyx.connect({

Check warning on line 1154 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETA_CONFIGURATION,
callback: (value) => (betaConfiguration = value ?? {}),
});

let deprecatedAllTransactions: OnyxCollection<Transaction> = {};
let deprecatedReportsTransactions: Record<string, Transaction[]> = {};
Onyx.connect({

Check warning on line 1161 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1184,7 +1184,7 @@
});

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 1187 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand Down Expand Up @@ -11285,7 +11285,7 @@
actionName: IOUAction;
reportActionID: string | undefined;
introSelected: OnyxEntry<IntroSelected>;
allTransactionDrafts: OnyxCollection<Transaction>;
draftTransactionIDs: string[] | undefined;
activePolicy: OnyxEntry<Policy>;
userBillingGraceEndPeriods: OnyxCollection<BillingGraceEndPeriod>;
amountOwed: OnyxEntry<number>;
Expand All @@ -11299,7 +11299,7 @@
actionName,
reportActionID,
introSelected,
allTransactionDrafts,
draftTransactionIDs,
activePolicy,
userBillingGraceEndPeriods,
amountOwed,
Expand Down Expand Up @@ -11329,7 +11329,7 @@
attendees: transaction?.modifiedAttendees ?? baseComment.attendees,
};

removeDraftTransactions(false, allTransactionDrafts);
removeDraftTransactionsByIDs(draftTransactionIDs);

createDraftTransaction({
...transaction,
Expand Down
9 changes: 2 additions & 7 deletions src/libs/actions/IOU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ import {buildOptimisticPolicyRecentlyUsedTags} from '@userActions/Policy/Tag';
import type {GuidedSetupData} from '@userActions/Report';
import {buildInviteToRoomOnyxData, completeOnboarding, notifyNewAction, optimisticReportLastData} from '@userActions/Report';
import {mergeTransactionIdsHighlightOnSearchRoute, sanitizeWaypointsForAPI, stringifyWaypointsForAPI} from '@userActions/Transaction';
import {removeDraftTransaction, removeDraftTransactions, removeDraftTransactionsByIDs} from '@userActions/TransactionEdit';
import {removeDraftTransaction, removeDraftTransactionsByIDs} from '@userActions/TransactionEdit';
import {getOnboardingMessages} from '@userActions/Welcome/OnboardingFlow';
import type {OnboardingCompanySize} from '@userActions/Welcome/OnboardingFlow';
import type {IOUAction, IOUActionParams, IOUType, OdometerImageType} from '@src/CONST';
Expand Down Expand Up @@ -1271,12 +1271,7 @@ function initMoneyRequest({
const created = currentDate ?? format(new Date(), 'yyyy-MM-dd');

// We remove draft transactions created during multi scanning if there are some
if (draftTransactionIDs) {
const idsToRemove = draftTransactionIDs.filter((id) => id !== CONST.IOU.OPTIMISTIC_TRANSACTION_ID);
removeDraftTransactionsByIDs(idsToRemove);
} else {
removeDraftTransactions(true);
}
removeDraftTransactionsByIDs(draftTransactionIDs, true);

// in case we have to re-init money request, but the IOU request type is the same with the old draft transaction,
// we should keep most of the existing data by using the ONYX MERGE operation
Expand Down
14 changes: 0 additions & 14 deletions src/libs/actions/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,6 @@ import type {Waypoint, WaypointCollection} from '@src/types/onyx/Transaction';
import type TransactionState from '@src/types/utils/TransactionStateType';
import {getPolicyTags} from './IOU/index';

let allTransactionDrafts: OnyxCollection<Transaction> = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.TRANSACTION_DRAFT,
waitForCollectionCallback: true,
callback: (value) => {
allTransactionDrafts = value ?? {};
},
});

let allReports: OnyxCollection<Report> = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,
Expand Down Expand Up @@ -1622,10 +1613,6 @@ function changeTransactionsReport({
});
}

function getDraftTransactions(draftTransactions?: OnyxCollection<Transaction>): Transaction[] {
return Object.values(draftTransactions ?? allTransactionDrafts ?? {}).filter((transaction): transaction is Transaction => !!transaction);
}

function mergeTransactionIdsHighlightOnSearchRoute(type: SearchDataTypes, data: Record<string, boolean> | null) {
return Onyx.merge(ONYXKEYS.TRANSACTION_IDS_HIGHLIGHT_ON_SEARCH_ROUTE, {[type]: data});
}
Expand All @@ -1650,7 +1637,6 @@ export {
clearError,
markAsCash,
dismissDuplicateTransactionViolation,
getDraftTransactions,
generateTransactionID,
setReviewDuplicatesKey,
abandonReviewDuplicateTransactions,
Expand Down
25 changes: 6 additions & 19 deletions src/libs/actions/TransactionEdit.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {format} from 'date-fns';
import Onyx from 'react-native-onyx';
import type {Connection, OnyxCollection, OnyxEntry} from 'react-native-onyx';
import type {Connection, OnyxEntry} from 'react-native-onyx';
import {formatCurrentUserToAttendee} from '@libs/IOUUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {PersonalDetails, Transaction} from '@src/types/onyx';
import {generateTransactionID, getDraftTransactions} from './Transaction';
import {generateTransactionID} from './Transaction';

let connection: Connection;

Expand Down Expand Up @@ -99,28 +99,16 @@ function removeDraftSplitTransaction(transactionID: string | undefined) {
Onyx.set(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transactionID}`, null);
}

function removeDraftTransactions(shouldExcludeInitialTransaction = false, allTransactionDrafts?: OnyxCollection<Transaction>) {
const draftTransactions = getDraftTransactions(allTransactionDrafts);
const draftTransactionsSet = draftTransactions.reduce(
(acc, item) => {
if (shouldExcludeInitialTransaction && item.transactionID === CONST.IOU.OPTIMISTIC_TRANSACTION_ID) {
return acc;
}
acc[`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${item.transactionID}`] = null;
return acc;
},
{} as Record<string, null>,
);
Onyx.multiSet(draftTransactionsSet);
}

function removeDraftTransactionsByIDs(transactionIDs: string[] | undefined) {
function removeDraftTransactionsByIDs(transactionIDs: string[] | undefined, shouldExcludeInitialTransaction = false) {
if (!transactionIDs?.length) {
return;
}

const draftTransactionsSet = transactionIDs.reduce(
(acc, transactionID) => {
if (shouldExcludeInitialTransaction && transactionID === CONST.IOU.OPTIMISTIC_TRANSACTION_ID) {
return acc;
}
acc[`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`] = null;
return acc;
},
Expand Down Expand Up @@ -190,7 +178,6 @@ export {
createDraftTransaction,
removeDraftTransaction,
removeTransactionReceipt,
removeDraftTransactions,
removeDraftTransactionsByIDs,
removeDraftSplitTransaction,
replaceDefaultDraftTransaction,
Expand Down
11 changes: 6 additions & 5 deletions src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {StackActions} from '@react-navigation/native';
import {validTransactionDraftIDsSelector} from '@selectors/TransactionDraft';
import React, {useCallback, useEffect, useMemo} from 'react';
import {InteractionManager, View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
Expand Down Expand Up @@ -191,7 +192,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
const [isDebugModeEnabled = false] = useOnyx(ONYXKEYS.IS_DEBUG_MODE_ENABLED);
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [allTransactionDrafts] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT);
const [draftTransactionIDs] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, {selector: validTransactionDraftIDsSelector});
const [allTransactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS);
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const {showConfirmModal} = useConfirmModal();
Expand Down Expand Up @@ -458,7 +459,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
actionName: CONST.IOU.ACTION.SUBMIT,
reportActionID: actionableWhisperReportActionID,
introSelected,
allTransactionDrafts,
draftTransactionIDs,
activePolicy,
userBillingGraceEndPeriods,
amountOwed,
Expand All @@ -481,7 +482,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
actionName: CONST.IOU.ACTION.CATEGORIZE,
reportActionID: actionableWhisperReportActionID,
introSelected,
allTransactionDrafts,
draftTransactionIDs,
activePolicy,
userBillingGraceEndPeriods,
amountOwed,
Expand All @@ -501,7 +502,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
actionName: CONST.IOU.ACTION.SHARE,
reportActionID: actionableWhisperReportActionID,
introSelected,
allTransactionDrafts,
draftTransactionIDs,
activePolicy,
userBillingGraceEndPeriods,
amountOwed,
Expand Down Expand Up @@ -627,7 +628,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
isRestrictedToPreferredPolicy,
preferredPolicyID,
introSelected,
allTransactionDrafts,
draftTransactionIDs,
activePolicy,
parentReport,
reportActionsForOriginalReportID,
Expand Down
1 change: 1 addition & 0 deletions src/pages/Share/SubmitDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function SubmitDetailsPage({
const fileName = shouldUsePreValidatedFile ? getFileName(validFilesToUpload?.uri ?? CONST.ATTACHMENT_IMAGE_DEFAULT_NAME) : getFileName(currentAttachment?.content ?? '');
const fileType = shouldUsePreValidatedFile ? (validFilesToUpload?.type ?? CONST.RECEIPT_ALLOWED_FILE_TYPES.JPEG) : (currentAttachment?.mimeType ?? '');
const [hasOnlyPersonalPolicies = false] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: hasOnlyPersonalPoliciesUtil});

useEffect(() => {
if (!errorTitle || !errorMessage) {
return;
Expand Down
14 changes: 7 additions & 7 deletions src/pages/inbox/report/PureReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ type PureReportActionItemProps = {
/** Model of onboarding selected */
introSelected?: OnyxEntry<OnyxTypes.IntroSelected>;

/** All transaction drafts */
allTransactionDrafts: OnyxCollection<OnyxTypes.Transaction>;
/** All transaction draft IDs */
draftTransactionIDs: string[] | undefined;

/** Report for this action */
report: OnyxEntry<OnyxTypes.Report>;
Expand Down Expand Up @@ -480,7 +480,7 @@ const isEmptyHTML = <T extends React.JSX.Element>({props: {html}}: T): boolean =
function PureReportActionItem({
personalPolicyID,
introSelected,
allTransactionDrafts,
draftTransactionIDs,
action,
report,
policy,
Expand Down Expand Up @@ -945,7 +945,7 @@ function PureReportActionItem({
actionName: CONST.IOU.ACTION.SUBMIT,
reportActionID: action.reportActionID,
introSelected,
allTransactionDrafts,
draftTransactionIDs,
activePolicy,
userBillingGraceEndPeriods,
amountOwed,
Expand All @@ -968,7 +968,7 @@ function PureReportActionItem({
actionName: CONST.IOU.ACTION.CATEGORIZE,
reportActionID: action.reportActionID,
introSelected,
allTransactionDrafts,
draftTransactionIDs,
activePolicy,
userBillingGraceEndPeriods,
amountOwed,
Expand All @@ -985,7 +985,7 @@ function PureReportActionItem({
actionName: CONST.IOU.ACTION.SHARE,
reportActionID: action.reportActionID,
introSelected,
allTransactionDrafts,
draftTransactionIDs,
activePolicy,
userBillingGraceEndPeriods,
amountOwed,
Expand Down Expand Up @@ -1128,7 +1128,7 @@ function PureReportActionItem({
isOriginalReportArchived,
resolveActionableMentionWhisper,
introSelected,
allTransactionDrafts,
draftTransactionIDs,
activePolicy,
report,
originalReport,
Expand Down
7 changes: 4 additions & 3 deletions src/pages/inbox/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {validTransactionDraftIDsSelector} from '@selectors/TransactionDraft';
import React, {useCallback} from 'react';
import type {OnyxEntry} from 'react-native-onyx';
import {useBlockedFromConcierge} from '@components/OnyxListItemProvider';
Expand Down Expand Up @@ -39,7 +40,7 @@ import PureReportActionItem from './PureReportActionItem';

type ReportActionItemProps = Omit<
PureReportActionItemProps,
'taskReport' | 'linkedReport' | 'iouReportOfLinkedReport' | 'currentUserAccountID' | 'personalPolicyID' | 'allTransactionDrafts' | 'userBillingGraceEndPeriods'
'taskReport' | 'linkedReport' | 'iouReportOfLinkedReport' | 'currentUserAccountID' | 'personalPolicyID' | 'draftTransactionIDs' | 'userBillingGraceEndPeriods'
> & {
/** Whether to show the draft message or not */
shouldShowDraftMessage?: boolean;
Expand Down Expand Up @@ -93,7 +94,7 @@ function ReportActionItem({
const policyIDForTags = report?.policyID === CONST.POLICY.OWNER_EMAIL_FAKE && policyForMovingExpensesID ? policyForMovingExpensesID : report?.policyID;
const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyIDForTags}`);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [allTransactionDrafts] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT);
const [draftTransactionIDs] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, {selector: validTransactionDraftIDsSelector});
const [reportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`);
const [originalReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${originalReportID}`);
const [iouReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getIOUReportIDFromReportActionPreview(action)}`);
Expand Down Expand Up @@ -134,7 +135,7 @@ function ReportActionItem({
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
introSelected={introSelected}
allTransactionDrafts={allTransactionDrafts}
draftTransactionIDs={draftTransactionIDs}
personalPolicyID={personalPolicyID}
action={action}
report={report}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ import {getReceiverType, sendInvoice} from '@userActions/IOU/SendInvoice';
import {sendMoneyElsewhere, sendMoneyWithWallet} from '@userActions/IOU/SendMoney';
import {splitBill, splitBillAndOpenReport, startSplitBill} from '@userActions/IOU/Split';
import {openDraftWorkspaceRequest} from '@userActions/Policy/Policy';
import {removeDraftTransaction, removeDraftTransactions, replaceDefaultDraftTransaction} from '@userActions/TransactionEdit';
import {removeDraftTransaction, removeDraftTransactionsByIDs, replaceDefaultDraftTransaction} from '@userActions/TransactionEdit';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
Expand Down Expand Up @@ -596,7 +596,7 @@ function IOURequestStepConfirmation({
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_SCAN.getRoute(CONST.IOU.ACTION.CREATE, iouType, initialTransactionID, reportID, Navigation.getActiveRouteWithoutParams()));
return;
}
removeDraftTransactions(true);
removeDraftTransactionsByIDs(draftTransactionIDs, true);
navigateToStartMoneyRequestStep(requestType, iouType, initialTransactionID, reportID);
});
}, [requestType, iouType, initialTransactionID, reportID, action, report, transactions, participants]);
Expand Down
Loading
Loading