Skip to content

Home - Spend over time chart does not auto update after editing it #86533

Closed

Description

@nlemma

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.3.50-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #84011
Email or phone of affected tester (no customers): snodijosdnjoijiosnj@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an expense.
  4. Go to Home.
  5. Click Begin next to Submit 1 report.
  6. Click Amount.
  7. Edit amount and save it.
  8. Close the report RHP.

Expected Result:

Spend over time chart will auto update.

Actual Result:

Spend over time chart does not auto update.
It only updates after changing to a different tab and back to Home.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7114891_1774615390285.1.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 27, 2026
  2. melvin-bot commented on Mar 27, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #84011

  3. melvin-bot commented on Mar 27, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on Mar 27, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. MelvinBot commented on Mar 27, 2026

    @MelvinBot
    Contributor

    I have failed to help you. I let you down and for that I am sorry. Please try again later. This may be due to a Claude outage (check here).

    Failure details: https://github.com/Expensify/Expensify/actions/runs/23647316674

  6. OSBotify commented on Mar 27, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug (requires App repository fix)
    Causing PR: Unknown - Unable to identify with high confidence
    Related Issues: None found

    Recommendation: NEEDS INVESTIGATION

    The SpendOverTime chart caching/refresh mechanism appears to be broken, but I cannot confidently identify which PR in the current staging deploy caused this regression. PR #84011 (mentioned in the issue) modifies ForYouSection but is not the root cause - ForYouSection and SpendOverTimeSection are independent sibling components.

    Labels: No label changes - keeping DeployBlockerCash since this is staging-only and requires investigation

    Detailed Analysis

    Evidence

    The bug report indicates:

    • SpendOverTime chart does not auto-update after editing an expense amount
    • Chart only updates after switching tabs and returning to Home
    • Reproducible on staging: YES
    • Reproducible on production: NO

    This is a staging-only regression introduced in deploy 9.3.50-0.

    Technical Root Cause

    The useSpendOverTimeData hook (in src/pages/home/SpendOverTimeSection/useSpendOverTimeData.ts) fetches search data based on two dependencies:

    useEffect(() => {
        onConfigChanged();
    }, [config.hash, isOffline]);

    The config.hash for SPEND_OVER_TIME is static - it is computed from the search query parameters (last 12 months, grouped by month), NOT from the actual transaction data. When a transaction amount is edited:

    1. The transaction data in Onyx is updated
    2. The search results snapshot (ONYXKEYS.COLLECTION.SNAPSHOT${queryJSON?.hash}) becomes stale
    3. But config.hash does NOT change (it is query-based, not data-based)
    4. Therefore, the useEffect never re-runs to fetch fresh data
    5. The chart continues showing stale cached data until the component unmounts and remounts (e.g., switching tabs)

    Why PR #84011 is NOT the cause

    PR #84011 "fixed Begin button behavior in Home" modified:

    • src/pages/home/ForYouSection/index.tsx - Added memoization for navigation handlers
    • src/selectors/Todos.ts - Added selector for single report IDs

    These changes only affect the ForYouSection component. SpendOverTimeSection is a sibling component in the HomePage layout and does not share any state, selectors, or dependencies with ForYouSection. The memoization changes in ForYouSection cannot affect SpendOverTimeSection rendering or data fetching.

    Investigation Needed

    To identify the causing PR, we need to:

    1. Check if any PRs in this deploy modified search snapshot caching/invalidation logic
    2. Check if any PRs modified transaction update flows that should trigger search data refresh
    3. Review PRs that touched src/libs/actions/IOU/index.ts or src/libs/actions/Search.ts
    4. Test on staging to see if there are missing invalidation calls when transactions are modified

    Candidate PRs to investigate (from staging deploy checklist):

    • Any PR modifying IOU/transaction editing flows
    • Any PR modifying search data caching or snapshot management
    • Any PR affecting the Home page widget rendering lifecycle

    @mukhrr (author of PR #84011) - While your PR was linked to this issue by melvin-bot, my investigation shows it is not the cause of this bug. The SpendOverTime chart issue is related to search snapshot caching, which your PR does not modify.

    Can the reporter or QA team help identify if there are other PRs in this deploy that modified transaction editing or search caching behavior?

  7. added a commit that references this issue on Mar 27, 2026
    9f25bd5
  8. mukhrr commented on Mar 27, 2026

    @mukhrr
    Contributor

    I think it'd be fair to accept this as a separate issue rather than regression since this feature (Spend over time) was merged to main after a day from my last commit in the PR. cc @justinpersaud @mallenexpensify

  9. 4 remaining items

  10. puneetlath commented on Mar 27, 2026

    @puneetlath
    Contributor

    @trjExpensify do you think it's important for this graph to update when someone creates/edits an expense from the homepage? I'm ambivalent.

  11. trjExpensify commented on Mar 27, 2026

    @trjExpensify
    Contributor

    Ehh... yeah, me too. It's better UX if it does update on edit, as the tables do when you edit in the RHP and close them.

  12. mhawryluk commented on Mar 30, 2026

    @mhawryluk
    Member

    making the widget update when the data changes is tricky, because we get the data for the chart by querying the backend and we don't keep the snapshot up to date when the data changes when it is grouped.

    we can fix the issue by invoking the search action not only when we navigate to the home page or come back online, but also when the page regains focus, so e.g. after opening and closing an RHP.

    it would look like this:

    const onConfigChanged = useEffectEvent(fetchData);
    
    const isFocused = useIsFocused();
    useEffect(() => {
        if (!isFocused) {
            return;
        }
        onConfigChanged();
    }, [config.hash, isOffline, isFocused]);

    however, this has its cost as this will increase the number of backend calls we schedule, with Search command being potentially a quite heavy operation. and a lot of the times we would call it when no data changed at all. but maybe this isn't an issue since this depends on the number of user interactions and same could currently happen when repeatedly switching between the tabs?

  13. melvin-bot commented on Mar 30, 2026

    @melvin-bot

    @puneetlath Whoops! This issue is 2 days overdue. Let's get this updated quick!

  14. melvin-bot commented on Mar 30, 2026

    @melvin-bot

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

  15. melvin-bot commented on Mar 30, 2026

    @melvin-bot

    @puneetlath Whoops! This issue is 2 days overdue. Let's get this updated quick!

  16. puneetlath commented on Apr 1, 2026

    @puneetlath
    Contributor

    Thanks for the analysis @mhawryluk. I'm thinking that we should just not worry about this. I don't think anyone really expects it to get updated in that scenario or is going to notice that it doesn't. I don't think it's worth adding the complexity for.

    @trjExpensify or others, feel free to reopen this and keep the discussion going if you disagree.

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

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions