Skip to content

[hold for payment 2025-12-19] [$250] Next steps- Next steps message remain unchanged until refresh #70926

Closed

Description

@jponikarchuk

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.2.16-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: Exploratory
Email or phone of affected tester (no customers): testpayment935@gmail.com
Issue reported by: Applause Internal Team
Device used: Web, mWeb
App Component: Chat Report View

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Go to workspace
  3. Create an IOU and note the next step message
  4. Go down to report and click remove from report to make the IOU unreported

Expected Result:

The next step message should automatically change to "waiting for you to add expenses"

Actual Result:

The next step message remain unchanged saying "waiting for you to submit expenses" until refresh or navigating back again.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
Issue Owner

Current Issue Owner: @

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 20, 2025
  2. melvin-bot commented on Sep 20, 2025

    @melvin-bot

    Triggered auto assignment to @joekaufmanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. ShridharGoel commented on Sep 20, 2025

    @ShridharGoel
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When a user removes an IOU from an expense report, the next step message does not automatically update to reflect the new state of the report. Specifically:

    • Expected Behavior: After removing an IOU from a report, the next step message should change from "Waiting for you to submit expense(s)" to "Waiting for you to add expense(s)"
    • Actual Behavior: The next step message remains unchanged, still showing "Waiting for you to submit expense(s)" until the user refreshes the page or navigates away and back

    What is the root cause of that problem?

    The root cause lies in the changeTransactionsReport function in src/libs/actions/Transaction.ts. When transactions are moved between reports (including when removing an IOU from a report), the function only updates the next step message for the destination report, not for the source report that had transactions removed from it.

    1. The function calculates updated totals for all affected reports but only updates the next step message for the destination report (line 1170 in the original code)

    2. When an IOU is removed from a report, the source report's next step message is not recalculated, even though its total has changed

    3. This creates a state where the report's total reflects the removal of expenses, but the next step message still indicates the old state

    // 9. Update next step for report
    const nextStepReport = {...newReport, total: updatedReportTotals[reportID] ?? newReport?.total, reportID: newReport?.reportID ?? reportID};
    const hasViolations = hasViolationsReportUtils(nextStepReport?.reportID, allTransactionViolation);
    const optimisticNextStep = buildNextStepNew(
    nextStepReport,
    policy,
    accountID,
    email,
    hasViolations,
    isASAPSubmitBetaEnabled,
    nextStepReport.statusNum ?? CONST.REPORT.STATUS_NUM.OPEN,
    shouldFixViolations,
    );
    optimisticData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${reportID}`,
    value: optimisticNextStep,
    });
    failureData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${reportID}`,
    value: reportNextStep,
    });

    The issue is that reportID here refers to the destination report (where transactions are moved TO), not the source report (where transactions are removed FROM).

    What changes do you think we should make in order to solve the problem?

    The fix involves modifying the changeTransactionsReport function to update the next step message for all reports that have their totals changed, not just the destination report.

    1. Collect all report IDs that have updated totals from the updatedReportTotals object
    2. Calculate and update the next step message for each affected report using its updated totals

    Updated Implementation:

    // 9. Update next step for all affected reports
    const allAffectedReportIDs = new Set([...Object.keys(updatedReportTotals), reportID]);
    
    allAffectedReportIDs.forEach((affectedReportID) => {
        const affectedReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${affectedReportID}`];
        if (!affectedReport) {
            return;
        }
        
        const updatedReport = {
            ...affectedReport,
            total: updatedReportTotals[affectedReportID] ?? affectedReport.total,
            reportID: affectedReport.reportID ?? affectedReportID,
        };
        
        const hasViolations = hasViolationsReportUtils(updatedReport.reportID, allTransactionViolation);
        const optimisticNextStep = buildNextStepNew(
            updatedReport,
            policy,
            accountID,
            email,
            hasViolations,
            isASAPSubmitBetaEnabled,
            updatedReport.statusNum ?? CONST.REPORT.STATUS_NUM.OPEN,
            shouldFixViolations,
        );
        
        optimisticData.push({
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${affectedReportID}`,
            value: optimisticNextStep,
        });
        
        // Only add failure data for the main report to avoid conflicts
        if (affectedReportID === reportID) {
            failureData.push({
                onyxMethod: Onyx.METHOD.MERGE,
                key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${reportID}`,
                value: reportNextStep,
            });
        }
    });
    Screen.Recording.2025-09-20.at.8.02.39.PM.mov

    We can make certain optimisations in the code while working on the final implementation.

    1. Now when an IOU is removed from a report, both the source report (where the IOU was removed) and the destination report (unreported) get their next step messages updated
    2. Each report's next step is calculated using its updated totals, ensuring the message accurately reflects whether the report has expenses or not
    3. The optimistic updates ensure the UI reflects the correct state immediately, without requiring a page refresh

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    describe('changeTransactionsReport - Next Step Updates', () => {
        it('should update next step message when removing last expense from report', () => {
            // Test implementation
        });
        
        it('should maintain submit message when removing expense from multi-expense report', () => {
            // Test implementation
        });
        
        it('should update next steps for both source and destination reports', () => {
            // Test implementation
        });
    });
  4. daledah commented on Sep 20, 2025

    @daledah
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    The next step message remain unchanged saying "waiting for you to submit expenses" until refresh or navigating back again.

    What is the root cause of that problem?

    We are just handling the next step for the report that the transaction will be moved to here.

    const nextStepReport = {...newReport, total: updatedReportTotals[reportID] ?? newReport?.total, reportID: newReport?.reportID ?? reportID};
    const hasViolations = hasViolationsReportUtils(nextStepReport?.reportID, allTransactionViolation);
    const optimisticNextStep = buildNextStepNew(
    nextStepReport,
    policy,
    accountID,
    email,
    hasViolations,
    isASAPSubmitBetaEnabled,
    nextStepReport.statusNum ?? CONST.REPORT.STATUS_NUM.OPEN,
    shouldFixViolations,
    );
    optimisticData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${reportID}`,
    value: optimisticNextStep,
    });
    failureData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.NEXT_STEP}${reportID}`,
    value: reportNextStep,
    });

    What changes do you think we should make in order to solve the problem?

    Because we will not have the most accurate data for the old report, so I think the best way here will be to handle it in the Back End

    That means after calling the api ChangeTransactionsReport, we will create another params called oldReportIDList and it will include all the oldReportID here and the Back End will return the onyx key reportNextStep of those reports

    const parameters: ChangeTransactionsReportParams = {
    transactionList: transactionIDs.join(','),
    reportID,
    transactionIDToReportActionAndThreadData: JSON.stringify(transactionIDToReportActionAndThreadData),
    };

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    None

    What alternative solutions did you explore? (Optional)

    NA

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  5. joekaufmanexpensify commented on Sep 22, 2025

    @joekaufmanexpensify
    Contributor

    This is a minor issue, but would be good to address 👍

  6. changed the title [-]Next steps- Next steps message remain unchanged until refresh[/-] [+][$250] Next steps- Next steps message remain unchanged until refresh[/+] on Sep 22, 2025
  7. melvin-bot commented on Sep 22, 2025

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Sep 22, 2025
  9. melvin-bot commented on Sep 22, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane (External)

  10. changed the title [-][$250] Next steps- Next steps message remain unchanged until refresh[/-] [+][$125] Next steps- Next steps message remain unchanged until refresh[/+] on Sep 22, 2025
  11. melvin-bot commented on Sep 22, 2025

    @melvin-bot

    ⚠️ Failed to update price automatically. The BZ team member will need to update the price manually in Upwork.

  12. 59 remaining items

  13. ShridharGoel commented on Dec 19, 2025

    @ShridharGoel
    Contributor

    @joekaufmanexpensify This is due for payment, thanks

  14. joekaufmanexpensify commented on Dec 19, 2025

    @joekaufmanexpensify
    Contributor

    Checked out the DB above and it looks like it was not caused by this issue's PR so no regression penalty here.

  15. joekaufmanexpensify commented on Dec 19, 2025

    @joekaufmanexpensify
    Contributor

    OG Upwork job closed before @ShridharGoel accepted the offer, so I opened a new job and sent a new offer. Please accept @ShridharGoel

  16. joekaufmanexpensify commented on Dec 19, 2025

    @joekaufmanexpensify
    Contributor

    Payment Summary

  17. ShridharGoel commented on Dec 19, 2025

    @ShridharGoel
    Contributor

    @joekaufmanexpensify My payment is also via NewDot

  18. joekaufmanexpensify commented on Dec 19, 2025

    @joekaufmanexpensify
    Contributor

    I see you became eligible for NewDot payments on 2025-09-20 and we hired you here 2025-10-01, so confirmed we are good to pay you via NewDot for this one 👍

  19. joekaufmanexpensify commented on Dec 19, 2025

    @joekaufmanexpensify
    Contributor

    Upwork job closed

  20. joekaufmanexpensify commented on Dec 19, 2025

    @joekaufmanexpensify
    Contributor

    @ShridharGoel @parasharrajat please request payment at your earliest convenience. Closing as this is otherwise all set 👍

  21. JmillsExpensify commented on Dec 23, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @ShridharGoel

  22. parasharrajat commented on Mar 19, 2026

    @parasharrajat
    Member

    Payment requested as per #70926 (comment)

  23. twisterdotcom commented on Mar 23, 2026

    @twisterdotcom
    Contributor

    Confirming Payment Summary. @parasharrajat paid via New Expensify

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions