Skip to content

[Due for payment 2025-09-26] [$250] Expense - App crashes when submitting expense in Reports > Submit offline #69984

Closed

Description

@lanitochka17

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: 9.2.2-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: #69355
Email or phone of affected tester (no customers): sdjoisnjsosjo@gmail.com
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Log in with a new account
  3. Create a workspace
  4. Go to Reports > Submit
  5. Go offline
  6. Click Create report
  7. Click + > Create expense > Manual
  8. Create a manual expense

Expected Result:

App will not crash

Actual Result:

App crashes

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
Bug6936456_1757101500703.Screen_Recording_2025-09-06_at_03.39.20.mp4

logs (3).txt

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021964063290320656137
  • Upwork Job ID: 1964063290320656137
  • Last Price Increase: 2025-09-05
  • Automatic offers:
    • nkdengineer | Contributor | 108740391
Issue OwnerCurrent Issue Owner: @lschurr

Activity

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

    @melvin-bot

    Triggered auto assignment to @lschurr (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. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Sep 5, 2025
  4. changed the title [-]Expense - App crashes when submitting expense in Reports > Submit offline[/-] [+][$250] Expense - App crashes when submitting expense in Reports > Submit offline[/+] on Sep 5, 2025
  5. melvin-bot commented on Sep 5, 2025

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

    @melvin-bot

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

  8. thedavos commented on Sep 6, 2025

    @thedavos
    Contributor

    Proposal

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

    When a user goes offline and creates a manual expense from Reports → Submit → Create report → + → Create expense → Manual, the app crashes. This occurs reliably after switching to offline mode and saving the expense.

    What is the root cause of that problem?

    While offline, some ReportAction items do not have a stable reportActionID.

    ReportActionsList’s keyExtractor was using reportActionID for every item. When this key is missing/unstable then React treats list items as new elements, remounts them, and repeatedly triggers layout/scroll effects. In an InvertedFlatList, this causes auto-scroll and boundary loaders to re-fire, producing a render → layout → scroll → data change loop that ends in Maximum update depth exceeded.

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

    Adopt a memoized key extractor that is aware of offline mode:

    • If the item is the synthetic CREATED row and the app is offline, return a constant, stable key (e.g., "CREATED").
      For all other items, continue using reportActionID as the key.
    • This makes the CREATED item identity stable during offline rendering, preventing unnecessary remounts and breaking the scroll/layout feedback loop that leads to the crash.

    Note: This proposal intentionally limits scope to the minimal, targeted fix described above.

        /**
         * Memoized key extractor for FlatList/InvertedFlatList.
         * - When offline and the synthetic `CREATED` item is present, return a constant key to keep it stable
         *   and avoid remounts that can trigger scroll/layout loops.
         * - For all other items, use `reportActionID` (expected to be stable and unique).
         */
        const keyExtractor = useCallback(
            (item: OnyxTypes.ReportAction) => {
                if (item.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED && isOffline) {
                    return CONST.REPORT.ACTIONS.TYPE.CREATED;
                }
    
                return item.reportActionID;
            },
            [isOffline],
        );

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

    --

    What alternative solutions did you explore? (Optional)

    --

    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.

  9. github-actions commented on Sep 6, 2025

    @github-actions
    Contributor

    ⚠️ @thedavos Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).

  10. thedavos commented on Sep 6, 2025

    @thedavos
    Contributor

    Proposal updated to follow proposal template

  11. nkdengineer commented on Sep 6, 2025

    @nkdengineer
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-09-06 03:26:14 UTC.

    Proposal

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

    App crashes

    What is the root cause of that problem?

    We're getting

    const reportActions = getFilteredReportActionsForReportView(unfilteredReportActions);

    but don't wrap it inside useMemo so it render too many times, when it changes we will re-render the whole list too many times, and cause the maximum update depth exceeded

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

    We should wrap it in the useMemo

        const reportActions = useMemo(() => {
            return getFilteredReportActionsForReportView(unfilteredReportActions);
        }, [unfilteredReportActions]);
    

    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)

    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.

  12. melvin-bot commented on Sep 8, 2025

    @melvin-bot

    @ishpaul777 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  13. 13 remaining items

  14. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Sep 19, 2025
  15. changed the title [-][$250] Expense - App crashes when submitting expense in Reports > Submit offline[/-] [+][Due for payment 2025-09-26] [$250] Expense - App crashes when submitting expense in Reports > Submit offline[/+] on Sep 19, 2025
  16. melvin-bot commented on Sep 19, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  17. melvin-bot commented on Sep 19, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.15-15 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-09-26. 🎊

    For reference, here are some details about the assignees on this issue:

  18. melvin-bot commented on Sep 19, 2025

    @melvin-bot

    @ishpaul777 @lschurr The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  19. ishpaul777 commented on Sep 25, 2025

    @ishpaul777
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: https://github.com/Expensify/App/pull/62002/files#r2380422738

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: app crash is critical, but here its a rare edge case becuase of implementaion now its fixed no need for discussion

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again. - no need we have enough QA tests covering Submit expense flow online and offline

  20. lschurr commented on Sep 26, 2025

    @lschurr
    Contributor

    Payment Summary

    Contributor: @nkdengineer paid $250 via Upwork
    Contributor+: @ishpaul777 due $250 via NewDot

  21. trjExpensify commented on Sep 29, 2025

    @trjExpensify
    Contributor

    approved $250 for @ishpaul777

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 contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions