Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8375f84
handle pre-mount destination
jmgraa Jul 28, 2026
954c5cf
create expense before reveal transition
jmgraa Jul 28, 2026
5f2a408
delay navigation until next screen is ready when 1:1 chat doesn't exist
jmgraa Jul 28, 2026
bb0a638
mock getReportOrDraftReport in SubmitDetailsPageTest
jmgraa Jul 29, 2026
754d5c1
expect shouldNavigate in cleanup nav test
jmgraa Jul 29, 2026
acdd657
clarify expense creation timing during reveal transition
jmgraa Jul 29, 2026
d415c6d
prevent dual navigation race condition during optimistic report landing
jmgraa Jul 29, 2026
5000852
sync cleanup transition wait with shouldNavigate
jmgraa Jul 30, 2026
9926795
move draft skip comment to getReportOrDraftReport call
jmgraa Jul 30, 2026
d9035d8
add navigationReportID parameter for consistent navigation
jmgraa Jul 30, 2026
ce543eb
run expense creation before revealing
jmgraa Jul 30, 2026
7d736c8
passing parameters when shouldNavigate is false
jmgraa Jul 30, 2026
10fdcaf
add two tests for race conditions
jmgraa Jul 30, 2026
ad9e965
add test for narrow layout and rename old one
jmgraa Jul 30, 2026
1a336ea
mock getTopmostReportId in resetNavigationMocksForSubmitDetailsPageTests
jmgraa Jul 30, 2026
343b12a
add test to handle confirm before scheduleWhenIdle fires in narrow la…
jmgraa Jul 30, 2026
ad3c671
change default layout to narrow
jmgraa Jul 30, 2026
086951e
remove redundant mocks and lean on the onyx seeding
jmgraa Jul 30, 2026
b34ffd3
add optimisticChatReportID parameter to requestMoney
jmgraa Jul 30, 2026
346f2dd
track reveal state
jmgraa Jul 30, 2026
a482333
cancel tracking before reveal
jmgraa Jul 30, 2026
5d127a9
perform cleanup after reveal's afterTransition
jmgraa Jul 30, 2026
436748a
fix preMountDestinationRoute conditions based on getSubmitExpensePreM…
jmgraa Jul 30, 2026
c8d82dc
add eslint-disable for console.warn
jmgraa Jul 30, 2026
95f52d3
replace console.warn with Log.warn
jmgraa Jul 31, 2026
f7308b0
update documentation for telemetry span ownership
jmgraa Jul 31, 2026
7d62db5
expect warning for active span lifecycle
jmgraa Jul 31, 2026
6c77fe2
reset mocked isTracking value
jmgraa Jul 31, 2026
bba0aa1
cancel stale tracking span before performing expense creation
jmgraa Jul 31, 2026
9cc60f1
use getSubmitExpensePreMountDestinationRoute
jmgraa Jul 31, 2026
ea99c34
add timeout for pending report arrival
jmgraa Jul 31, 2026
92e4914
use narrow layout mock as default
jmgraa Jul 31, 2026
6a40cca
add fallback navigation for optimistic report ID mismatch
jmgraa Jul 31, 2026
19d8139
add fallback navigation for non-topmost report ID during expense crea…
jmgraa Jul 31, 2026
f0f70a4
pass routeReportID instead of reportOrAccountID as optimistic chat IDs
jmgraa Aug 3, 2026
6c8c738
use single reveal function
jmgraa Aug 3, 2026
1e152ce
Merge remote-tracking branch 'upstream' into jmgraa/share-extension-c…
jmgraa Aug 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Log from '@libs/Log';
import {getReportOrDraftReport, isMoneyRequestReport} from '@libs/ReportUtils';
import {isTracking} from '@libs/telemetry/submitFollowUpAction';

import CONST from '@src/CONST';
import type {Report, ReportAction} from '@src/types/onyx';
Expand All @@ -19,6 +21,18 @@ type CleanupAndNavigateAfterExpenseCreateParams = {
isInvoice?: boolean;
linkedTrackedExpenseReportAction?: OnyxEntry<ReportAction>;
action: DeepValueOf<typeof CONST.IOU.ACTION>;
/** When false, runs cleanup only — use when dismiss/reveal already handled navigation.
* IMPORTANT: Caller must own telemetry span lifecycle. SubmitExpenseOrchestrator starts
* SPAN_SUBMIT_EXPENSE before calling createTransaction; when shouldNavigate=false, caller
* is responsible for ending the span (see useExpenseSubmission createTransaction).
* Skips shouldWaitForUpcomingTransition, so transition never arrives (no 1s timeout).
*/
shouldNavigate?: boolean;
Comment thread
jmgraa marked this conversation as resolved.
/** Pre-computed navigation report ID. When provided, used instead of recomputing
* from report/backToReport/optimisticChatReportID to ensure UI and state register
* against the same destination.
*/
navigationReportID?: string;
};

function cleanupAndNavigateAfterExpenseCreate({
Expand All @@ -31,14 +45,20 @@ function cleanupAndNavigateAfterExpenseCreate({
isInvoice,
linkedTrackedExpenseReportAction,
action,
shouldNavigate = true,
navigationReportID,
}: CleanupAndNavigateAfterExpenseCreateParams) {
if (__DEV__ && isTracking() && !shouldNavigate) {
Log.warn('[cleanupAndNavigateAfterExpenseCreate] shouldNavigate=false but span is active. Caller must own span lifecycle — miss this and span hangs 60s until dropped.');
}

cleanupAfterExpenseCreate({
draftTransactionIDs,
linkedTrackedExpenseReportAction,
shouldWaitForUpcomingTransition: true,
shouldWaitForUpcomingTransition: shouldNavigate,
});

const finalActiveReportID = backToReport ?? report?.reportID ?? optimisticChatReportID;
const finalActiveReportID = navigationReportID ?? backToReport ?? report?.reportID ?? optimisticChatReportID;
const hasMultipleTransactions = isInvoice ? false : isMoneyRequestReport(finalActiveReportID === report?.reportID ? report : getReportOrDraftReport(finalActiveReportID));
const shouldAddPendingNewTransactionIDs =
action === CONST.IOU.ACTION.CATEGORIZE || action === CONST.IOU.ACTION.SHARE ? true : !isInvoice && !!finalActiveReportID && !hasMultipleTransactions;
Expand All @@ -50,6 +70,7 @@ function cleanupAndNavigateAfterExpenseCreate({
isInvoice,
hasMultipleTransactions,
shouldAddPendingNewTransactionIDs,
shouldNavigate,
});
}

Expand Down
Loading
Loading