Skip to content

[$250] 'Export to Sage Intacct' button still visible after report is exported #64591

Closed

Description

@m-natarajan

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:
Reproducible in staging?: Needs Reproduction
Reproducible in production?: Needs Reproduction
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @JS00001
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

Precondition: Sage intacct accounting software connected

  1. Open a report eligible for export to Sage Intacct
  2. Click the 'Export to Sage Intacct' button and complete the export
  3. Observe the report after export is complete.

Expected Result:

The 'Export to Sage Intacct' button should be hidden or disabled once the report has been successfully exported.

Actual Result:

The button still appears on the report after export.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Image

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021935773793942704631
  • Upwork Job ID: 1935773793942704631
  • Last Price Increase: 2025-07-10
Issue OwnerCurrent Issue Owner: @dangrous

Activity

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

    @melvin-bot

    Triggered auto assignment to @maddylewis (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. MelvinBot commented on Jun 19, 2025

    @MelvinBot
    Contributor

    This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jun 19, 2025
  5. melvin-bot commented on Jun 19, 2025

    @melvin-bot
  6. changed the title [-]'Export to Sage Intacct' button still visible after report is exported[/-] [+][$250] 'Export to Sage Intacct' button still visible after report is exported[/+] on Jun 19, 2025
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 19, 2025
  8. melvin-bot commented on Jun 19, 2025

    @melvin-bot

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

  9. maddylewis commented on Jun 19, 2025

    @maddylewis
    Contributor

    @alitoshmatov - could you try reproducing this one when you have the chance?

  10. thelullabyy commented on Jun 20, 2025

    @thelullabyy
    Contributor

    Proposal

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

    The button still appears on the report after export.

    What is the root cause of that problem?

    Looking at the screenshot in the OP, the problem may come from isExported function. When we started exporting, an optimistic EXPORT_INTEGRATION action was created, but it's cleared if we reset cache and restart.

    It leads to failure if we export fails many times, integrationMessageActionsCount is larger than exportIntegrationActionsCount, and the isExported function returns false, which causes the Export button to still appear, even though it's already exported.

    App/src/libs/ReportUtils.ts

    Lines 10750 to 10778 in 4c48b2c

    }
    function isExported(reportActions: OnyxEntry<ReportActions> | ReportAction[]) {
    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)) {
    // We consider any reports marked manually as exported to be exported, so we shortcut here.
    if (getOriginalMessage(action)?.markedManually) {
    return true;
    }
    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;
    }

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

    Based on the comment, we create another EXPORT_INTEGRATION after the report is exported successfully. So we can return true if the EXPORT_INTEGRATION action isn't an optimistic action

    if (getOriginalMessage(action)?.markedManually || !action.pendingAction) {
        return true;
    }
    

    App/src/libs/ReportUtils.ts

    Lines 10750 to 10778 in 4c48b2c

    }
    function isExported(reportActions: OnyxEntry<ReportActions> | ReportAction[]) {
    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)) {
    // We consider any reports marked manually as exported to be exported, so we shortcut here.
    if (getOriginalMessage(action)?.markedManually) {
    return true;
    }
    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;
    }

    We can also replace this condition return exportIntegrationActionsCount > integrationMessageActionsCount by comparing the last EXPORT_INTEGRATION action index and last INTEGRATIONS_MESSAGE action index.

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

    Add a unit test for isExported function and verify it returns true if we have an EXPORT_INTEGRATION action without pendingAction.

    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.

  11. 56 remaining items

  12. kavimuru commented on Aug 1, 2025

    @kavimuru

    Bug is still reproducible

    Recording.3520.mp4
  13. lydiabarclay commented on Aug 4, 2025

    @lydiabarclay
    Contributor

    @dangrous what is the next action here if bug is still reproducible?

  14. dangrous commented on Aug 4, 2025

    @dangrous
    Contributor

    hrm @alitoshmatov do you have a moment to look into this on the front end and see if there's something else that's needed either on the FE or BE?

  15. alitoshmatov commented on Aug 6, 2025

    @alitoshmatov
    Contributor

    hrm @alitoshmatov do you have a moment to look into this on the front end and see if there's something else that's needed either on the FE or BE?

    No everything is working as expected.

    @alitoshmatov no payment needed, right?

    I reviewed this #65782 PR

  16. dangrous commented on Aug 7, 2025

    @dangrous
    Contributor

    wait are you saying it's not reproducible anymore @alitoshmatov ? shoudl we ask for a retest?

  17. mallenexpensify commented on Aug 8, 2025

    @mallenexpensify
    Contributor
  18. m-natarajan commented on Aug 8, 2025

    @m-natarajan
    Author

    Mac / Safari
    v9.1.91-0
    Export always fails on staging, If Marked as manually entered, then button disappears and it is Pass

    2_37.PM.2025-08-08.mp4
  19. dangrous commented on Aug 11, 2025

    @dangrous
    Contributor

    okay i think that's fine then!

  20. dangrous commented on Aug 12, 2025

    @dangrous
    Contributor

    so in summary - @alitoshmatov needs payment for review ($250), otherwise we are ready to close.

  21. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed
    ReviewingHas a PR in review
    on Aug 12, 2025
  22. mallenexpensify commented on Aug 12, 2025

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @alitoshmatov due $250 via NewDot

    Thx, closing

  23. garrettmknight commented on Aug 14, 2025

    @garrettmknight
    Contributor

    $250 approved for @alitoshmatov

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 contributorHelp WantedApply this label when an issue is open to proposals by contributorsNeeds ReproductionReproducible steps needed

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions