@@ -53,11 +53,10 @@ import {
5353} from '@libs/IOUUtils' ;
5454import Log from '@libs/Log' ;
5555import dismissModalAndOpenReportInInboxTabHelper from '@libs/Navigation/helpers/dismissModalAndOpenReportInInboxTab' ;
56- import isReportOpenInRHP from '@libs/Navigation/helpers/isReportOpenInRHP' ;
5756import isReportTopmostSplitNavigator from '@libs/Navigation/helpers/isReportTopmostSplitNavigator' ;
5857import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute' ;
5958import navigateAfterExpenseCreate from '@libs/Navigation/helpers/navigateAfterExpenseCreate' ;
60- import Navigation , { navigationRef } from '@libs/Navigation/Navigation' ;
59+ import Navigation from '@libs/Navigation/Navigation' ;
6160import { rand64 , roundToTwoDecimalPlaces } from '@libs/NumberUtils' ;
6261import { getParticipantsOption , getReportOption } from '@libs/OptionsListUtils' ;
6362import {
@@ -104,7 +103,6 @@ import {requestMoney as requestMoneyIOUActions, trackExpense as trackExpenseIOUA
104103import { removeDraftTransaction , replaceDefaultDraftTransaction } from '@userActions/TransactionEdit' ;
105104import CONST from '@src/CONST' ;
106105import ONYXKEYS from '@src/ONYXKEYS' ;
107- import type { Route } from '@src/ROUTES' ;
108106import ROUTES from '@src/ROUTES' ;
109107import type SCREENS from '@src/SCREENS' ;
110108import type { RecentlyUsedCategories , Report } from '@src/types/onyx' ;
@@ -388,40 +386,25 @@ function IOURequestStepConfirmation({
388386
389387 const hasPreInsertFired = useRef ( false ) ;
390388 const isTransactionReady = ! ! transaction ;
391- const destinationReportID = backToReport ?? report ?. reportID ;
392-
393389 useEffect ( ( ) => {
394390 if ( hasPreInsertFired . current || ! isTransactionReady || ! getIsNarrowLayout ( ) ) {
395391 return ;
396392 }
397393
398394 // Search pre-insert: global create flows that navigate to Search after submit.
395+ // Report pre-insert is intentionally omitted here — it requires the fast-path
396+ // handlers (handleReportPreInsert) introduced in the follow-up PR to clear the
397+ // pre-insert flag on submit; without them the flag would get stuck.
399398 const shouldPreInsertSearch = isFromGlobalCreate && canPreInsertSearch && ! isReportTopmostSplitNavigator ( ) && ! isSearchTopmostFullScreenRoute ( ) ;
400399
401- // Report pre-insert: dismiss modal flows that open an existing report after submit.
402- // Skip when the destination is already the topmost fullscreen report to avoid
403- // pushing a duplicate route (which would require an extra back press).
404- const shouldPreInsertReport =
405- ! shouldPreInsertSearch &&
406- ( ! isFromGlobalCreate || isReportTopmostSplitNavigator ( ) ) &&
407- ! isReportOpenInRHP ( navigationRef . getRootState ( ) ) &&
408- ! ! destinationReportID &&
409- Navigation . getTopmostReportId ( ) !== destinationReportID &&
410- ! ! getReportOrDraftReport ( destinationReportID ) ?. reportID ;
411-
412- if ( ! shouldPreInsertSearch && ! shouldPreInsertReport ) {
400+ if ( ! shouldPreInsertSearch ) {
413401 return ;
414402 }
415403
416404 hasPreInsertFired . current = true ;
417405
418- let route : Route ;
419- if ( shouldPreInsertSearch ) {
420- const type = iouType === CONST . IOU . TYPE . INVOICE ? CONST . SEARCH . DATA_TYPES . INVOICE : CONST . SEARCH . DATA_TYPES . EXPENSE ;
421- route = ROUTES . SEARCH_ROOT . getRoute ( { query : buildCannedSearchQuery ( { type} ) } ) ;
422- } else {
423- route = ROUTES . REPORT_WITH_ID . getRoute ( destinationReportID ) ;
424- }
406+ const type = iouType === CONST . IOU . TYPE . INVOICE ? CONST . SEARCH . DATA_TYPES . INVOICE : CONST . SEARCH . DATA_TYPES . EXPENSE ;
407+ const route = ROUTES . SEARCH_ROOT . getRoute ( { query : buildCannedSearchQuery ( { type} ) } ) ;
425408
426409 const timer = setTimeout ( ( ) => {
427410 Navigation . preInsertFullscreenUnderRHP ( route ) ;
@@ -437,11 +420,10 @@ function IOURequestStepConfirmation({
437420 Navigation . removePreInsertedFullscreenIfNeeded ( ) ;
438421 } ;
439422 // isFromGlobalCreate, iouType, and canPreInsertSearch are stable for the lifetime of
440- // this screen instance. isTransactionReady and destinationReportID may each flip once
441- // (false -> true / undefined→ID) as data loads asynchronously, re-triggering the effect.
442- // hasPreInsertFired prevents double-firing.
423+ // this screen instance. isTransactionReady flips once (false → true) as data loads
424+ // asynchronously, re-triggering the effect. hasPreInsertFired prevents double-firing.
443425 // eslint-disable-next-line react-hooks/exhaustive-deps
444- } , [ isTransactionReady , destinationReportID ] ) ;
426+ } , [ isTransactionReady ] ) ;
445427
446428 const navigateBack = useCallback ( ( ) => {
447429 if ( backTo ) {
0 commit comments