diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 7538a16d1a2c2..37003a09a0cd8 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -286,10 +286,6 @@ const ROUTES = { route: ':iouType/new/merchant/:reportID?', getRoute: (iouType: string, reportID = '') => `${iouType}/new/merchant/${reportID}` as const, }, - MONEY_REQUEST_WAYPOINT: { - route: ':iouType/new/waypoint/:waypointIndex', - getRoute: (iouType: string, waypointIndex: number) => `${iouType}/new/waypoint/${waypointIndex}` as const, - }, MONEY_REQUEST_RECEIPT: { route: ':iouType/new/receipt/:reportID?', getRoute: (iouType: string, reportID = '') => `${iouType}/new/receipt/${reportID}` as const, @@ -298,10 +294,6 @@ const ROUTES = { route: ':iouType/new/address/:reportID?', getRoute: (iouType: string, reportID = '') => `${iouType}/new/address/${reportID}` as const, }, - MONEY_REQUEST_EDIT_WAYPOINT: { - route: 'r/:threadReportID/edit/distance/:transactionID/waypoint/:waypointIndex', - getRoute: (threadReportID: number, transactionID: string, waypointIndex: number) => `r/${threadReportID}/edit/distance/${transactionID}/waypoint/${waypointIndex}` as const, - }, MONEY_REQUEST_DISTANCE_TAB: { route: ':iouType/new/:reportID?/distance', getRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}/distance` as const, @@ -378,9 +370,9 @@ const ROUTES = { getUrlWithBackToParam(`create/${iouType}/tag/${transactionID}/${reportID}`, backTo), }, MONEY_REQUEST_STEP_WAYPOINT: { - route: 'create/:iouType/waypoint/:transactionID/:reportID/:pageIndex', - getRoute: (iouType: ValueOf, transactionID: string, reportID: string, pageIndex = '', backTo = '') => - getUrlWithBackToParam(`create/${iouType}/waypoint/${transactionID}/${reportID}/${pageIndex}`, backTo), + route: ':action/:iouType/waypoint/:transactionID/:reportID/:pageIndex', + getRoute: (action: ValueOf, iouType: ValueOf, transactionID: string, reportID: string, pageIndex = '', backTo = '') => + getUrlWithBackToParam(`${action}/${iouType}/waypoint/${transactionID}/${reportID}/${pageIndex}`, backTo), }, // This URL is used as a redirect to one of the create tabs below. This is so that we can message users with a link // straight to those flows without needing to have optimistic transaction and report IDs. diff --git a/src/components/DistanceRequest/index.js b/src/components/DistanceRequest/index.js index 72be7c2b88735..b63ce337a1d96 100644 --- a/src/components/DistanceRequest/index.js +++ b/src/components/DistanceRequest/index.js @@ -24,6 +24,7 @@ import variables from '@styles/variables'; import * as MapboxToken from '@userActions/MapboxToken'; import * as Transaction from '@userActions/Transaction'; import * as TransactionEdit from '@userActions/TransactionEdit'; +import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import DistanceRequestFooter from './DistanceRequestFooter'; @@ -170,7 +171,9 @@ function DistanceRequest({transactionID, report, transaction, route, isEditingRe * @param {Number} index of the waypoint to edit */ const navigateToWaypointEditPage = (index) => { - Navigation.navigate(isEditingRequest ? ROUTES.MONEY_REQUEST_EDIT_WAYPOINT.getRoute(report.reportID, transactionID, index) : ROUTES.MONEY_REQUEST_WAYPOINT.getRoute('request', index)); + Navigation.navigate( + ROUTES.MONEY_REQUEST_STEP_WAYPOINT.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.REQUEST, transactionID, report.reportID, index, Navigation.getActiveRouteWithoutParams()), + ); }; const getError = () => { diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx index 4be1c988561bf..b0f33af0ce2e0 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx @@ -103,8 +103,7 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator require('../../../pages/AddPersonalBankAccountPage').default as React.ComponentType, [SCREENS.IOU_SEND.ADD_DEBIT_CARD]: () => require('../../../pages/settings/Wallet/AddDebitCardPage').default as React.ComponentType, [SCREENS.IOU_SEND.ENABLE_PAYMENTS]: () => require('../../../pages/EnablePayments/EnablePaymentsPage').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.WAYPOINT]: () => require('../../../pages/iou/NewDistanceRequestWaypointEditorPage').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.EDIT_WAYPOINT]: () => require('../../../pages/iou/MoneyRequestEditWaypointPage').default as React.ComponentType, + [SCREENS.MONEY_REQUEST.WAYPOINT]: () => require('../../../pages/iou/MoneyRequestWaypointPage').default as React.ComponentType, [SCREENS.MONEY_REQUEST.DISTANCE]: () => require('../../../pages/iou/NewDistanceRequestPage').default as React.ComponentType, [SCREENS.MONEY_REQUEST.RECEIPT]: () => require('../../../pages/EditRequestReceiptPage').default as React.ComponentType, }); diff --git a/src/libs/Navigation/linkingConfig.ts b/src/libs/Navigation/linkingConfig.ts index 5f2a607b5f78d..1a495e92eb80b 100644 --- a/src/libs/Navigation/linkingConfig.ts +++ b/src/libs/Navigation/linkingConfig.ts @@ -433,8 +433,6 @@ const linkingConfig: LinkingOptions = { [SCREENS.MONEY_REQUEST.CATEGORY]: ROUTES.MONEY_REQUEST_CATEGORY.route, [SCREENS.MONEY_REQUEST.TAG]: ROUTES.MONEY_REQUEST_TAG.route, [SCREENS.MONEY_REQUEST.MERCHANT]: ROUTES.MONEY_REQUEST_MERCHANT.route, - [SCREENS.MONEY_REQUEST.WAYPOINT]: ROUTES.MONEY_REQUEST_WAYPOINT.route, - [SCREENS.MONEY_REQUEST.EDIT_WAYPOINT]: ROUTES.MONEY_REQUEST_EDIT_WAYPOINT.route, [SCREENS.MONEY_REQUEST.RECEIPT]: ROUTES.MONEY_REQUEST_RECEIPT.route, [SCREENS.MONEY_REQUEST.DISTANCE]: ROUTES.MONEY_REQUEST_DISTANCE.route, [SCREENS.IOU_SEND.ENABLE_PAYMENTS]: ROUTES.IOU_SEND_ENABLE_PAYMENTS, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 90f5361f11f40..8563db7db1722 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -241,12 +241,6 @@ type MoneyRequestNavigatorParamList = { waypointIndex: string; threadReportID: number; }; - [SCREENS.MONEY_REQUEST.EDIT_WAYPOINT]: { - iouType: string; - transactionID: string; - waypointIndex: string; - threadReportID: number; - }; [SCREENS.MONEY_REQUEST.DISTANCE]: { iouType: ValueOf; reportID: string; diff --git a/src/libs/actions/Transaction.ts b/src/libs/actions/Transaction.ts index 674d0c0006560..430de0557674f 100644 --- a/src/libs/actions/Transaction.ts +++ b/src/libs/actions/Transaction.ts @@ -58,7 +58,7 @@ function addStop(transactionID: string) { } function saveWaypoint(transactionID: string, index: string, waypoint: RecentWaypoint | null, isDraft = false) { - Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION : ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, { + Onyx.merge(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, { comment: { waypoints: { [`waypoint${index}`]: waypoint, diff --git a/src/pages/iou/MoneyRequestEditWaypointPage.js b/src/pages/iou/MoneyRequestEditWaypointPage.js deleted file mode 100644 index fc777891109e8..0000000000000 --- a/src/pages/iou/MoneyRequestEditWaypointPage.js +++ /dev/null @@ -1,32 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import WaypointEditor from './WaypointEditor'; - -const propTypes = { - /** Route params */ - route: PropTypes.shape({ - params: PropTypes.shape({ - /** Thread reportID */ - threadReportID: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), - - /** ID of the transaction being edited */ - transactionID: PropTypes.string, - - /** Index of the waypoint being edited */ - waypointIndex: PropTypes.string, - }), - }), -}; - -const defaultProps = { - route: {}, -}; - -function MoneyRequestEditWaypointPage({route}) { - return ; -} - -MoneyRequestEditWaypointPage.displayName = 'MoneyRequestEditWaypointPage'; -MoneyRequestEditWaypointPage.propTypes = propTypes; -MoneyRequestEditWaypointPage.defaultProps = defaultProps; -export default MoneyRequestEditWaypointPage; diff --git a/src/pages/iou/NewDistanceRequestWaypointEditorPage.js b/src/pages/iou/MoneyRequestWaypointPage.js similarity index 77% rename from src/pages/iou/NewDistanceRequestWaypointEditorPage.js rename to src/pages/iou/MoneyRequestWaypointPage.js index 269cde5770405..2f8b8b9cc7295 100644 --- a/src/pages/iou/NewDistanceRequestWaypointEditorPage.js +++ b/src/pages/iou/MoneyRequestWaypointPage.js @@ -2,7 +2,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import {withOnyx} from 'react-native-onyx'; import ONYXKEYS from '@src/ONYXKEYS'; -import WaypointEditor from './WaypointEditor'; +import IOURequestStepWaypoint from './request/step/IOURequestStepWaypoint'; const propTypes = { /** The transactionID of this request */ @@ -32,9 +32,9 @@ const defaultProps = { // This component is responsible for grabbing the transactionID from the IOU key // You can't use Onyx props in the withOnyx mapping, so we need to set up and access the transactionID here, and then pass it down so that WaypointEditor can subscribe to the transaction. -function NewDistanceRequestWaypointEditorPage({transactionID, route}) { +function MoneyRequestWaypointPage({transactionID, route}) { return ( - iou && iou.transactionID}, -})(NewDistanceRequestWaypointEditorPage); +})(MoneyRequestWaypointPage); diff --git a/src/pages/iou/WaypointEditor.js b/src/pages/iou/WaypointEditor.js deleted file mode 100644 index ab88740911529..0000000000000 --- a/src/pages/iou/WaypointEditor.js +++ /dev/null @@ -1,292 +0,0 @@ -import {useNavigation} from '@react-navigation/native'; -import lodashGet from 'lodash/get'; -import PropTypes from 'prop-types'; -import React, {useMemo, useRef, useState} from 'react'; -import {withOnyx} from 'react-native-onyx'; -import _ from 'underscore'; -import AddressSearch from '@components/AddressSearch'; -import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; -import ConfirmModal from '@components/ConfirmModal'; -import FormProvider from '@components/Form/FormProvider'; -import InputWrapper from '@components/Form/InputWrapper'; -import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import * as Expensicons from '@components/Icon/Expensicons'; -import ScreenWrapper from '@components/ScreenWrapper'; -import transactionPropTypes from '@components/transactionPropTypes'; -import useLocalize from '@hooks/useLocalize'; -import useLocationBias from '@hooks/useLocationBias'; -import useNetwork from '@hooks/useNetwork'; -import useThemeStyles from '@hooks/useThemeStyles'; -import useWindowDimensions from '@hooks/useWindowDimensions'; -import * as ErrorUtils from '@libs/ErrorUtils'; -import Navigation from '@libs/Navigation/Navigation'; -import * as ValidationUtils from '@libs/ValidationUtils'; -import * as Transaction from '@userActions/Transaction'; -import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; - -const propTypes = { - /** Route params */ - route: PropTypes.shape({ - params: PropTypes.shape({ - /** IOU type */ - iouType: PropTypes.string, - - /** Thread reportID */ - threadReportID: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), - - /** ID of the transaction being edited */ - transactionID: PropTypes.string, - - /** Index of the waypoint being edited */ - waypointIndex: PropTypes.string, - }), - }), - - /* Current location coordinates of the user */ - userLocation: PropTypes.shape({ - /** Latitude of the location */ - latitude: PropTypes.number, - - /** Longitude of the location */ - longitude: PropTypes.number, - }), - - recentWaypoints: PropTypes.arrayOf( - PropTypes.shape({ - /** The name of the location */ - name: PropTypes.string, - - /** A description of the location (usually the address) */ - description: PropTypes.string, - - /** Data required by the google auto complete plugin to know where to put the markers on the map */ - geometry: PropTypes.shape({ - /** Data about the location */ - location: PropTypes.shape({ - /** Latitude of the location */ - lat: PropTypes.number, - - /** Longitude of the location */ - lng: PropTypes.number, - }), - }), - }), - ), - - /* Onyx props */ - /** The optimistic transaction for this request */ - transaction: transactionPropTypes, -}; - -const defaultProps = { - route: {}, - recentWaypoints: [], - transaction: {}, - userLocation: undefined, -}; - -function WaypointEditor({route: {params: {iouType = '', transactionID = '', waypointIndex = '', threadReportID = 0}} = {}, transaction, recentWaypoints, userLocation}) { - const styles = useThemeStyles(); - const {windowWidth} = useWindowDimensions(); - const [isDeleteStopModalOpen, setIsDeleteStopModalOpen] = useState(false); - const navigation = useNavigation(); - const isFocused = navigation.isFocused(); - const {translate} = useLocalize(); - const {isOffline} = useNetwork(); - const textInput = useRef(null); - const parsedWaypointIndex = parseInt(waypointIndex, 10); - const allWaypoints = lodashGet(transaction, 'comment.waypoints', {}); - const currentWaypoint = lodashGet(allWaypoints, `waypoint${waypointIndex}`, {}); - - const waypointCount = _.size(allWaypoints); - const filledWaypointCount = _.size(_.filter(allWaypoints, (waypoint) => !_.isEmpty(waypoint))); - const locationBias = useLocationBias(allWaypoints, userLocation); - const waypointDescriptionKey = useMemo(() => { - switch (parsedWaypointIndex) { - case 0: - return 'distance.waypointDescription.start'; - case waypointCount - 1: - return 'distance.waypointDescription.finish'; - default: - return 'distance.waypointDescription.stop'; - } - }, [parsedWaypointIndex, waypointCount]); - - const waypointAddress = lodashGet(currentWaypoint, 'address', ''); - const isEditingWaypoint = Boolean(threadReportID); - // Hide the menu when there is only start and finish waypoint - const shouldShowThreeDotsButton = waypointCount > 2; - const shouldDisableEditor = - isFocused && - (Number.isNaN(parsedWaypointIndex) || parsedWaypointIndex < 0 || parsedWaypointIndex > waypointCount || (filledWaypointCount < 2 && parsedWaypointIndex >= waypointCount)); - - const validate = (values) => { - const errors = {}; - const waypointValue = values[`waypoint${waypointIndex}`] || ''; - if (isOffline && waypointValue !== '' && !ValidationUtils.isValidAddress(waypointValue)) { - ErrorUtils.addErrorMessage(errors, `waypoint${waypointIndex}`, 'bankAccount.error.address'); - } - - // If the user is online, and they are trying to save a value without using the autocomplete, show an error message instructing them to use a selected address instead. - // That enables us to save the address with coordinates when it is selected - if (!isOffline && waypointValue !== '' && waypointAddress !== waypointValue) { - ErrorUtils.addErrorMessage(errors, `waypoint${waypointIndex}`, 'distance.errors.selectSuggestedAddress'); - } - - return errors; - }; - - const saveWaypoint = (waypoint) => Transaction.saveWaypoint(transactionID, waypointIndex, waypoint, isEditingWaypoint); - - const submit = (values) => { - const waypointValue = values[`waypoint${waypointIndex}`] || ''; - - // Allows letting you set a waypoint to an empty value - if (waypointValue === '') { - Transaction.removeWaypoint(transaction, waypointIndex); - } - - // While the user is offline, the auto-complete address search will not work - // Therefore, we're going to save the waypoint as just the address, and the lat/long will be filled in on the backend - if (isOffline && waypointValue) { - const waypoint = { - lat: null, - lng: null, - address: waypointValue, - name: null, - }; - saveWaypoint(waypoint); - } - - // Other flows will be handled by selecting a waypoint with selectWaypoint as this is mainly for the offline flow - Navigation.goBack(ROUTES.MONEY_REQUEST_DISTANCE_TAB.getRoute(iouType)); - }; - - const deleteStopAndHideModal = () => { - Transaction.removeWaypoint(transaction, waypointIndex); - setIsDeleteStopModalOpen(false); - Navigation.goBack(ROUTES.MONEY_REQUEST_DISTANCE_TAB.getRoute(iouType)); - }; - - const selectWaypoint = (values) => { - const waypoint = { - lat: values.lat, - lng: values.lng, - address: values.address, - name: values.name || null, - }; - saveWaypoint(waypoint); - - if (isEditingWaypoint) { - Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(threadReportID)); - return; - } - Navigation.goBack(ROUTES.MONEY_REQUEST_DISTANCE_TAB.getRoute(iouType)); - }; - - return ( - textInput.current && textInput.current.focus()} - shouldEnableMaxHeight - testID={WaypointEditor.displayName} - > - - { - Navigation.goBack(ROUTES.MONEY_REQUEST_DISTANCE_TAB.getRoute(iouType)); - }} - shouldShowThreeDotsButton={shouldShowThreeDotsButton} - threeDotsAnchorPosition={styles.threeDotsPopoverOffset(windowWidth)} - threeDotsMenuItems={[ - { - icon: Expensicons.Trashcan, - text: translate('distance.deleteWaypoint'), - onSelected: () => setIsDeleteStopModalOpen(true), - }, - ]} - /> - setIsDeleteStopModalOpen(false)} - prompt={translate('distance.deleteWaypointConfirmation')} - confirmText={translate('common.delete')} - cancelText={translate('common.cancel')} - danger - /> - - (textInput.current = e)} - hint={!isOffline ? 'distance.errors.selectSuggestedAddress' : ''} - containerStyles={[styles.mt3]} - label={translate('distance.address')} - defaultValue={waypointAddress} - onPress={selectWaypoint} - maxInputLength={CONST.FORM_CHARACTER_LIMIT} - renamedInputKeys={{ - address: `waypoint${waypointIndex}`, - city: null, - country: null, - street: null, - street2: null, - zipCode: null, - lat: null, - lng: null, - state: null, - }} - predefinedPlaces={recentWaypoints} - resultTypes="" - /> - - - - ); -} - -WaypointEditor.displayName = 'WaypointEditor'; -WaypointEditor.propTypes = propTypes; -WaypointEditor.defaultProps = defaultProps; -export default withOnyx({ - userLocation: { - key: ONYXKEYS.USER_LOCATION, - }, - transaction: { - key: ({route}) => `${ONYXKEYS.COLLECTION.TRANSACTION}${lodashGet(route, 'params.transactionID')}`, - }, - recentWaypoints: { - key: ONYXKEYS.NVP_RECENT_WAYPOINTS, - - // Only grab the most recent 5 waypoints because that's all that is shown in the UI. This also puts them into the format of data - // that the google autocomplete component expects for it's "predefined places" feature. - selector: (waypoints) => - _.map(waypoints ? waypoints.slice(0, 5) : [], (waypoint) => ({ - name: waypoint.name, - description: waypoint.address, - geometry: { - location: { - lat: waypoint.lat, - lng: waypoint.lng, - }, - }, - })), - }, -})(WaypointEditor); diff --git a/src/pages/iou/request/step/IOURequestStepDistance.js b/src/pages/iou/request/step/IOURequestStepDistance.js index ddf692fedd462..9549a93c81249 100644 --- a/src/pages/iou/request/step/IOURequestStepDistance.js +++ b/src/pages/iou/request/step/IOURequestStepDistance.js @@ -21,6 +21,7 @@ import variables from '@styles/variables'; import * as IOU from '@userActions/IOU'; import * as MapboxToken from '@userActions/MapboxToken'; import * as Transaction from '@userActions/Transaction'; +import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import IOURequestStepRoutePropTypes from './IOURequestStepRoutePropTypes'; import StepScreenWrapper from './StepScreenWrapper'; @@ -102,7 +103,9 @@ function IOURequestStepDistance({ * @param {Number} index of the waypoint to edit */ const navigateToWaypointEditPage = (index) => { - Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_WAYPOINT.getRoute(iouType, transactionID, reportID, index)); + Navigation.navigate( + ROUTES.MONEY_REQUEST_STEP_WAYPOINT.getRoute(CONST.IOU.ACTION.CREATE, CONST.IOU.TYPE.REQUEST, transactionID, report.reportID, index, Navigation.getActiveRouteWithoutParams()), + ); }; const navigateToNextStep = useCallback(() => { diff --git a/src/pages/iou/request/step/IOURequestStepWaypoint.js b/src/pages/iou/request/step/IOURequestStepWaypoint.js index 09617026576d1..1087018eeed94 100644 --- a/src/pages/iou/request/step/IOURequestStepWaypoint.js +++ b/src/pages/iou/request/step/IOURequestStepWaypoint.js @@ -81,7 +81,7 @@ const defaultProps = { function IOURequestStepWaypoint({ recentWaypoints, route: { - params: {iouType, pageIndex, reportID, transactionID}, + params: {action, backTo, iouType, pageIndex, reportID, transactionID}, }, transaction, userLocation, @@ -135,7 +135,7 @@ function IOURequestStepWaypoint({ return errors; }; - const saveWaypoint = (waypoint) => Transaction.saveWaypoint(transactionID, pageIndex, waypoint, false); + const saveWaypoint = (waypoint) => Transaction.saveWaypoint(transactionID, pageIndex, waypoint, action === CONST.IOU.ACTION.CREATE); const submit = (values) => { const waypointValue = values[`waypoint${pageIndex}`] || ''; @@ -180,7 +180,11 @@ function IOURequestStepWaypoint({ address: values.address, name: values.name || null, }; - Transaction.saveWaypoint(transactionID, pageIndex, waypoint, false); + Transaction.saveWaypoint(transactionID, pageIndex, waypoint, action === CONST.IOU.ACTION.CREATE); + if (backTo) { + Navigation.goBack(backTo); + return; + } Navigation.goBack(ROUTES.MONEY_REQUEST_CREATE_TAB_DISTANCE.getRoute(iouType, transactionID, reportID)); }; diff --git a/src/pages/iou/request/step/withFullTransactionOrNotFound.js b/src/pages/iou/request/step/withFullTransactionOrNotFound.js index 001159f944e94..7cdbb3484999e 100644 --- a/src/pages/iou/request/step/withFullTransactionOrNotFound.js +++ b/src/pages/iou/request/step/withFullTransactionOrNotFound.js @@ -70,7 +70,8 @@ export default function (WrappedComponent) { transaction: { key: ({route}) => { const transactionID = lodashGet(route, 'params.transactionID', 0); - return `${transactionID === CONST.IOU.OPTIMISTIC_TRANSACTION_ID ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`; + const userAction = lodashGet(route, 'params.action', CONST.IOU.ACTION.CREATE); + return `${userAction === CONST.IOU.ACTION.CREATE ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`; }, }, })(WithFullTransactionOrNotFoundWithRef);