Skip to content

[No QA] Add support for waitingToExport report next step - #75759

Merged
dangrous merged 3 commits into
Expensify:mainfrom
rayane-d:add-waitingToExport-next-step
Nov 26, 2025
Merged

dangrous merged 3 commits into
Expensify:mainfrom
rayane-d:add-waitingToExport-next-step

Conversation

@rayane-d

@rayane-d rayane-d commented Nov 21, 2025 •

Copy link
Copy Markdown
Contributor

Explanation of Change

This next step was added in these PRs: https://github.com/Expensify/Web-Expensify/pull/49036 and https://github.com/Expensify/Auth/pull/17702
This PR adds support for it in the new report next step format in NewDot.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/528713
PROPOSAL:

Tests

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

@melvin-bot

melvin-bot Bot commented Nov 21, 2025

Copy link
Copy Markdown

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx ts-node ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx ts-node ./scripts/generateTranslations.ts --compare-ref main

@rayane-d
rayane-d requested a review from dangrous November 21, 2025 15:21
@rayane-d rayane-d assigned s77rt and unassigned s77rt Nov 21, 2025
@rayane-d
rayane-d requested a review from s77rt November 21, 2025 15:22
@rayane-d
rayane-d marked this pull request as ready for review November 21, 2025 15:23
@rayane-d
rayane-d requested review from a team as code owners November 21, 2025 15:23
@melvin-bot
melvin-bot Bot requested review from a team and dominictb and removed request for a team November 21, 2025 15:23
@melvin-bot

melvin-bot Bot commented Nov 21, 2025

Copy link
Copy Markdown

@dominictb Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot requested review from JmillsExpensify and brunovjk and removed request for a team November 21, 2025 15:23
@melvin-bot

melvin-bot Bot commented Nov 21, 2025

Copy link
Copy Markdown

@brunovjk Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

Comment thread src/languages/pt-BR.ts Resolved
@rayane-d

Copy link
Copy Markdown
Contributor Author

@dangrous, we don't need an optimistic next step for the "Waiting to Export" next step, right? Since it only occurs when the client is online.

@codecov

codecov Bot commented Nov 21, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/CONST/index.ts 85.71% <ø> (ø)
... and 95 files with indirect coverage changes

Comment thread src/languages/es.ts Resolved
@dangrous

dangrous commented Nov 21, 2025 •

Copy link
Copy Markdown
Contributor

@dangrous, we don't need an optimistic next step for the "Waiting to Export" next step, right? Since it only occurs when the client is online.

What comes right before that next step? I think we would need it to be optimistic if, say, the admin approved the report while offline? Or maybe I'm misunderstanding the flow. There are so many different states!

If we don't need optimistic than this is good to go once we confirm the spanish

@rayane-d

Copy link
Copy Markdown
Contributor Author

What comes right before that next step?

I think the next step before this next step can be:

  • Waiting for payer to pay expenses
  • Waiting for payment to complete by ...
  • No further actions required

I think we would need it to be optimistic if, say, the admin approved the report while offline?

But, I think, based on this issue, we only want to display this next step when the report export action failed, right?


Or maybe I'm misunderstanding the flow. There are so many different states!

  • We display the "Export" button when isExportAction returns true:

function isExportAction(report: Report, policy?: Policy, reportActions?: ReportAction[]) {
if (!policy) {
return false;
}
const connectedIntegration = getValidConnectedIntegration(policy);
const isInvoiceReport = isInvoiceReportUtils(report);
if (!connectedIntegration || isInvoiceReport) {
return false;
}
const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;
const isReportExporter = isPreferredExporter(policy);
if (!isReportExporter && !isAdmin) {
return false;
}
const syncEnabled = hasIntegrationAutoSync(policy, connectedIntegration);
const isExported = isExportedUtil(reportActions);
if (isExported) {
return false;
}
const hasExportError = hasExportErrorUtil(reportActions);
if (syncEnabled && !hasExportError) {
return false;
}
if (report.isWaitingOnBankAccount) {
return false;
}
const isReportReimbursed = isSettled(report);
const isReportApproved = isReportApprovedUtils({report});
const isReportClosed = isClosedReportUtils(report);
if (isReportApproved || isReportReimbursed || isReportClosed) {
return true;
}
return false;
}

function isExportAction(report: Report, policy?: Policy): boolean {
if (!policy) {
return false;
}
const hasAccountingConnection = !!getValidConnectedIntegration(policy);
if (!hasAccountingConnection) {
return false;
}
const isInvoiceReport = isInvoiceReportUtils(report);
// We don't allow export to accounting for invoice reports in OD so we want to align with that here.
if (isInvoiceReport) {
return false;
}
const isExpenseReport = isExpenseReportUtils(report);
if (!isExpenseReport) {
return false;
}
const isReportApproved = isReportApprovedUtils({report});
const isReportPayer = isPayerUtils(getSession(), report, false, policy);
const arePaymentsEnabled = arePaymentsEnabledUtils(policy);
const isReportClosed = isClosedReportUtils(report);
const isReportSettled = isSettled(report);
if (isReportPayer && arePaymentsEnabled && (isReportApproved || isReportClosed || isReportSettled)) {
return true;
}
const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;
const isReportReimbursed = report.statusNum === CONST.REPORT.STATUS_NUM.REIMBURSED;
const connectedIntegration = getConnectedIntegration(policy);
const syncEnabled = hasIntegrationAutoSync(policy, connectedIntegration);
const isReportFinished = isReportApproved || isReportReimbursed || isReportClosed;
return isAdmin && isReportFinished && syncEnabled;
}

  • So:

    • For payers, the button appears when the report is approved, closed, or settled, and payments are enabled.

    if (isReportPayer && arePaymentsEnabled && (isReportApproved || isReportClosed || isReportSettled)) {
    return true;
    }

    • For admins, the button appears when the report is approved, reimbursed, or closed, and auto-sync is enabled

    const isReportFinished = isReportApproved || isReportReimbursed || isReportClosed;
    return isAdmin && isReportFinished && syncEnabled;
    }

  • We consider export to have failed when: (!isExported && hasExportError) is true

App/src/libs/ReportUtils.ts

Lines 11992 to 12009 in 2b911a4

function hasExportError(reportActions: OnyxEntry<ReportActions> | ReportAction[], report?: OnyxEntry<Report>) {
// If report object is provided and has the property, use it directly
if (report?.hasExportError !== undefined) {
return report.hasExportError;
}
// Fallback to checking actions for backward compatibility
if (!reportActions) {
return false;
}
if (Array.isArray(reportActions)) {
return reportActions.some((action) => isIntegrationMessageAction(action));
}
return Object.values(reportActions).some((action) => isIntegrationMessageAction(action));
}

App/src/libs/ReportUtils.ts

Lines 11954 to 11991 in 2b911a4

function isExported(reportActions: OnyxEntry<ReportActions> | ReportAction[], report?: OnyxEntry<Report>): boolean {
// If report object is provided and has the property, use it directly
if (report?.isExportedToIntegration !== undefined) {
return report.isExportedToIntegration;
}
// Fallback to checking actions for backward compatibility
if (!reportActions) {
return false;
}
let exportIntegrationActionsCount = 0;
let integrationMessageActionsCount = 0;
const reportActionList = Array.isArray(reportActions) ? reportActions : Object.values(reportActions);
for (const action of reportActionList) {
if (isExportIntegrationAction(action)) {
const originalMessage = getOriginalMessage(action);
// We consider any reports marked manually as exported to be exported, so we shortcut here.
if (originalMessage?.markedManually) {
return true;
}
// exportTemplate type is a CSV export, so we don't count it as an export integration action
if (originalMessage?.type !== CONST.EXPORT_TEMPLATE) {
exportIntegrationActionsCount++;
}
}
if (isIntegrationMessageAction(action)) {
integrationMessageActionsCount++;
}
}
// We need to make sure that there was at least one successful export to consider the report exported.
// We add one EXPORT_INTEGRATION action to the report when we start exporting it (with pendingAction: 'add') and then another EXPORT_INTEGRATION when the export finishes successfully.
// If the export fails, we add an INTEGRATIONS_MESSAGE action to the report, but the initial EXPORT_INTEGRATION action is still present, so we compare the counts of these two actions to determine if the report was exported successfully.
return exportIntegrationActionsCount > integrationMessageActionsCount;
}

  • And here is the export user action function:

App/src/libs/actions/Report.ts

Lines 4651 to 4688 in 2b911a4

function exportToIntegration(reportID: string, connectionName: ConnectionName) {
const action = buildOptimisticExportIntegrationAction(connectionName);
const optimisticReportActionID = action.reportActionID;
const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
value: {
[optimisticReportActionID]: action,
},
},
];
const failureData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
value: {
[optimisticReportActionID]: {
errors: getMicroSecondOnyxErrorWithTranslationKey('common.genericErrorMessage'),
},
},
},
];
const params = {
reportIDList: reportID,
connectionName,
type: 'MANUAL',
optimisticReportActions: JSON.stringify({
[reportID]: optimisticReportActionID,
}),
} satisfies ReportExportParams;
API.write(WRITE_COMMANDS.REPORT_EXPORT, params, {optimisticData, failureData});
}

This function adds the optimistic EXPORT_INTEGRATION action and, on failure, adds an error to that action. The actual export error only arrives online, since the server is what determines whether the export succeeded.

  • Optimistic next steps logic:

App/src/libs/NextStepUtils.ts

Lines 761 to 1127 in 2b911a4

function buildNextStepNew(params: BuildNextStepNewParams): ReportNextStepDeprecated | null {
const {report, policy, currentUserAccountIDParam, currentUserEmailParam, hasViolations, isASAPSubmitBetaEnabled, predictedNextStatus, shouldFixViolations, isUnapprove, isReopen} =
params;
if (!isExpenseReport(report)) {
return null;
}
const {ownerAccountID = -1} = report ?? {};
const autoReportingFrequency = getCorrectedAutoReportingFrequency(policy);
const isInstantSubmitEnabled = autoReportingFrequency === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.INSTANT;
const shouldShowFixMessage = hasViolations && isInstantSubmitEnabled && !isASAPSubmitBetaEnabled;
const [policyOwnerPersonalDetails, ownerPersonalDetails] = getPersonalDetailsByIDs({
accountIDs: [policy?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID, ownerAccountID],
currentUserAccountID: currentUserAccountIDParam ?? CONST.DEFAULT_NUMBER_ID,
shouldChangeUserDisplayName: true,
});
const isReportContainingTransactions =
report &&
((report.total !== 0 && report.total !== undefined) ||
(report.unheldTotal !== 0 && report.unheldTotal !== undefined) ||
(report.unheldNonReimbursableTotal !== 0 && report.unheldNonReimbursableTotal !== undefined));
const {reimbursableSpend} = getMoneyRequestSpendBreakdown(report);
const ownerDisplayName = ownerPersonalDetails?.displayName ?? ownerPersonalDetails?.login ?? getDisplayNameForParticipant({accountID: ownerAccountID});
const policyOwnerDisplayName = policyOwnerPersonalDetails?.displayName ?? policyOwnerPersonalDetails?.login ?? getDisplayNameForParticipant({accountID: policy?.ownerAccountID});
const nextApproverDisplayName = getNextApproverDisplayName(report, isUnapprove);
const approverAccountID = getNextApproverAccountID(report, isUnapprove);
const approvers = getLoginsByAccountIDs([approverAccountID ?? CONST.DEFAULT_NUMBER_ID]);
const reimburserAccountID = getReimburserAccountID(policy);
const type: ReportNextStepDeprecated['type'] = 'neutral';
let optimisticNextStep: ReportNextStepDeprecated | null;
const nextStepPayExpense = {
type,
icon: CONST.NEXT_STEP.ICONS.HOURGLASS,
message: [
{
text: 'Waiting for ',
},
ownerAccountID === -1 || !policy?.ownerAccountID
? {
text: 'an admin',
}
: {
text: shouldShowFixMessage ? ownerDisplayName : policyOwnerDisplayName,
type: 'strong',
},
{
text: ' to ',
},
...(shouldShowFixMessage ? [{text: 'fix the issues'}] : [{text: 'pay'}, {text: ' %expenses.'}]),
],
};
const noActionRequired = {
icon: CONST.NEXT_STEP.ICONS.CHECKMARK,
type,
message: [
{
text: 'No further action required!',
},
],
};
switch (predictedNextStatus) {
// Generates an optimistic nextStep once a report has been opened
case CONST.REPORT.STATUS_NUM.OPEN:
if ((isASAPSubmitBetaEnabled && hasViolations && isInstantSubmitEnabled) || shouldFixViolations) {
optimisticNextStep = {
type,
icon: CONST.NEXT_STEP.ICONS.HOURGLASS,
message: [
{
text: 'Waiting for ',
},
{
text: `${ownerDisplayName}`,
type: 'strong',
clickToCopyText: ownerAccountID === currentUserAccountIDParam ? currentUserEmailParam : '',
},
{
text: ' to ',
},
{
text: 'fix the issues',
},
],
};
break;
}
if (isReopen) {
optimisticNextStep = {
type,
icon: CONST.NEXT_STEP.ICONS.HOURGLASS,
message: [
{
text: 'Waiting for ',
},
{
text: `${ownerDisplayName}`,
type: 'strong',
clickToCopyText: ownerAccountID === currentUserAccountIDParam ? currentUserEmailParam : '',
},
{
text: ' to ',
},
{
text: 'submit',
},
{
text: ' %expenses.',
},
],
};
break;
}
// Self review
optimisticNextStep = {
type,
icon: CONST.NEXT_STEP.ICONS.HOURGLASS,
message: [
{
text: 'Waiting for ',
},
{
text: `${ownerDisplayName}`,
type: 'strong',
clickToCopyText: ownerAccountID === currentUserAccountIDParam ? currentUserEmailParam : '',
},
{
text: ' to ',
},
{
text: 'add',
},
{
text: ' %expenses.',
},
],
};
// Scheduled submit enabled
if (policy?.harvesting?.enabled && autoReportingFrequency !== CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MANUAL && isReportContainingTransactions) {
optimisticNextStep.message = [
{
text: 'Waiting for ',
},
{
text: `${ownerDisplayName}`,
type: 'strong',
clickToCopyText: ownerAccountID === currentUserAccountIDParam ? currentUserEmailParam : '',
},
{
text: `'s`,
type: 'strong',
},
{
text: ' %expenses to automatically submit',
},
];
let harvestingSuffix = '';
if (autoReportingFrequency) {
const currentDate = new Date();
let autoSubmissionDate = '';
let monthlyText = '';
if (policy?.autoReportingOffset === CONST.POLICY.AUTO_REPORTING_OFFSET.LAST_DAY_OF_MONTH) {
monthlyText = 'on the last day of the month';
} else if (policy?.autoReportingOffset === CONST.POLICY.AUTO_REPORTING_OFFSET.LAST_BUSINESS_DAY_OF_MONTH) {
monthlyText = 'on the last business day of the month';
} else if (policy?.autoReportingOffset !== undefined) {
autoSubmissionDate = format(setDate(currentDate, policy?.autoReportingOffset), CONST.DATE.ORDINAL_DAY_OF_MONTH);
}
const harvestingSuffixes: Record<DeepValueOf<typeof CONST.POLICY.AUTO_REPORTING_FREQUENCIES>, string> = {
[CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE]: 'later today',
[CONST.POLICY.AUTO_REPORTING_FREQUENCIES.WEEKLY]: 'on Sunday',
[CONST.POLICY.AUTO_REPORTING_FREQUENCIES.SEMI_MONTHLY]: 'on the 1st and 16th of each month',
[CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MONTHLY]: autoSubmissionDate ? `on the ${autoSubmissionDate} of each month` : monthlyText,
[CONST.POLICY.AUTO_REPORTING_FREQUENCIES.TRIP]: 'at the end of their trip',
[CONST.POLICY.AUTO_REPORTING_FREQUENCIES.INSTANT]: '',
[CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MANUAL]: '',
};
if (harvestingSuffixes[autoReportingFrequency]) {
harvestingSuffix = `${harvestingSuffixes[autoReportingFrequency]}`;
}
}
optimisticNextStep.message.push({
text: ` ${harvestingSuffix}`,
});
}
// Manual submission
if (report?.total !== 0 && !policy?.harvesting?.enabled && autoReportingFrequency === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MANUAL) {
optimisticNextStep.message = [
{
text: 'Waiting for ',
},
{
text: `${ownerDisplayName}`,
type: 'strong',
clickToCopyText: ownerAccountID === currentUserAccountIDParam ? currentUserEmailParam : '',
},
{
text: ' to ',
},
{
text: 'submit',
},
{
text: ' %expenses.',
},
];
}
break;
// Generates an optimistic nextStep once a report has been submitted
case CONST.REPORT.STATUS_NUM.SUBMITTED: {
if (policy?.approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL) {
optimisticNextStep = reimbursableSpend === 0 ? noActionRequired : nextStepPayExpense;
break;
}
// Another owner
optimisticNextStep = {
type,
icon: CONST.NEXT_STEP.ICONS.HOURGLASS,
};
// We want to show pending approval next step for cases where the policy has approvals enabled
const policyApprovalMode = getApprovalWorkflow(policy);
if ([CONST.POLICY.APPROVAL_MODE.BASIC, CONST.POLICY.APPROVAL_MODE.ADVANCED].some((approvalMode) => approvalMode === policyApprovalMode)) {
optimisticNextStep.message = [
{
text: 'Waiting for ',
},
{
text: nextApproverDisplayName,
type: 'strong',
clickToCopyText: approvers.at(0),
},
{
text: ' to ',
},
{
text: 'approve',
},
{
text: ' %expenses.',
},
];
} else {
optimisticNextStep.message = [
{
text: 'Waiting for ',
},
isPayer(
{
accountID: currentUserAccountIDParam,
email: currentUserEmailParam,
},
report,
)
? {
text: `you`,
type: 'strong',
}
: {
text: `an admin`,
},
{
text: ' to ',
},
{
text: 'pay',
},
{
text: ' %expenses.',
},
];
}
break;
}
// Generates an optimistic nextStep once a report has been closed for example in the case of Submit and Close approval flow
case CONST.REPORT.STATUS_NUM.CLOSED:
optimisticNextStep = noActionRequired;
break;
// Generates an optimistic nextStep once a report has been paid
case CONST.REPORT.STATUS_NUM.REIMBURSED:
optimisticNextStep = noActionRequired;
break;
// Generates an optimistic nextStep once a report has been approved
case CONST.REPORT.STATUS_NUM.APPROVED: {
if (
isInvoiceReport(report) ||
!isPayer(
{
accountID: currentUserAccountIDParam,
email: currentUserEmailParam,
},
report,
) ||
reimbursableSpend === 0
) {
optimisticNextStep = noActionRequired;
break;
}
// Self review
let payerMessage: Message;
if (
isPayer(
{
accountID: currentUserAccountIDParam,
email: currentUserEmailParam,
},
report,
)
) {
payerMessage = {text: 'you', type: 'strong'};
} else if (reimburserAccountID === -1) {
payerMessage = {text: 'an admin'};
} else {
payerMessage = {text: getDisplayNameForParticipant({accountID: reimburserAccountID}), type: 'strong'};
}
optimisticNextStep = {
type,
icon: CONST.NEXT_STEP.ICONS.HOURGLASS,
message: [
{
text: 'Waiting for ',
},
payerMessage,
{
text: ' to ',
},
{
text: 'pay',
},
{
text: ' %expenses.',
},
],
};
break;
}
// Resets a nextStep
default:
optimisticNextStep = null;
}
return optimisticNextStep;
}

I don't think we can predict export failure. The client only receives failure data from the server while online. Export is a server-side process, and nothing in the client can reliably infer that the export will fail, and the failure signal only arrives after the server attempts the export. Please let me know if this makes sense!

@dangrous

dangrous commented Nov 25, 2025 •

Copy link
Copy Markdown
Contributor

Oh yep yep, my mistake! Yes we would never have an optimistic failure, so we should be good

@dangrous

Copy link
Copy Markdown
Contributor

@s77rt are you able to complete the PR checklist here?

@s77rt

s77rt commented Nov 26, 2025

Copy link
Copy Markdown
Member

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari

@dangrous
dangrous merged commit 51fe20d into Expensify:main Nov 26, 2025
2 checks passed
@rayane-d
rayane-d deleted the add-waitingToExport-next-step branch November 26, 2025 17:55
@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify OSBotify mentioned this pull request Nov 27, 2025
63 tasks done
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/dangrous in version: 9.2.65-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/marcaaron in version: 9.2.65-6 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants