Skip to content

[$175] Home - Stop live-updating the Insights chart on expense changes #106791

Open

Description

@MelvinBot

Problem

Home's Insights chart automatically reruns its Search whenever the expense-data signature changes. Leaving Home open while expenses are created or modified—including expenses shared with the signed-in user—can therefore repeatedly recompute the chart without any user interaction. This creates unnecessary search traffic, particularly for accounts with large expense histories or frequent incoming expenses.

The agreed behavior is to stop live-updating the Home chart, rather than throttle those expense-driven refreshes.

Expected behavior

  • Load the selected chart when Home is first opened.
  • Refresh when returning to Home, changing the selected chart, or reconnecting.
  • Do not rerun the chart search solely because an expense is created, edited, deleted, or pushed to the account while Home remains open.
  • Keep the existing refresh behavior of the other Home cards, including ToDos. Do not reintroduce chart refreshes merely from closing an RHP over Home.
  • Scope this change to the Home Insights chart; changing the full Insights page is not part of this issue.

Steps to reproduce

  1. Open Home and let the Insights chart finish loading.
  2. Monitor network requests for the selected chart's Search (for example, searchKey=spendOverTime).
  3. From another session, create an expense in a workspace accessible to the first account, and allow the update to reach that account. Repeat with multiple expenses.
  4. Observe additional chart searches without navigating away from Home or changing the chart.

Actual: Incoming expense changes cause fresh chart searches.

Expected: The chart retains its loaded snapshot until an allowed refresh trigger occurs.

Relevant code and context

Acceptance criteria

  • Incoming expense additions, relevant edits, and deletions do not trigger chart searches while Home stays open.
  • Initial load, returning to Home, changing the chart, and reconnecting still load fresh chart data.
  • Other Home cards continue updating as before.
  • Closing an RHP does not cause an unnecessary chart refresh.

Slack thread: https://expensify.slack.com/archives/C05CBC62HGW/p1794373512888039

Issue OwnerCurrent Issue Owner: @huult
Upwork Automation - Do Not Edit

Activity

  1. mountiny commented on Nov 12, 2026

    @mountiny
    Contributor

    @MelvinBot can you prepare a proposal for how to stop the live updates?

  2. MelvinBot commented on Nov 12, 2026

    @MelvinBot
    ContributorAuthor

    Proposal

    What is the root cause of that problem?

    The Home chart includes the expense-data counter in its refresh key. Expense changes therefore trigger another chart search—or queue one until an RHP closes—even when the selected chart has not changed.

    Code evidence

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

    Remove the expense-signature subscription and expense counter from the Home chart’s refresh key. Remove the accompanying comment describing expense-driven refreshes.

    Keep the existing tab-aware refresh hook and remaining dependencies. This preserves initial loading, returning to Home, changing charts, and reconnecting without treating RHP closure as a fresh Home visit.

    Leave the shared expense signature, other Home cards—including ToDos—and the full Insights page unchanged. No changes to Search requests or chart snapshot storage are needed.

    For this minimal change, retain existing workspace-membership and app-foreground refresh behavior; these are separate from expense-driven updates.

    Regression coverage

    Update useInsightDataRefreshTest.ts:109–170, which currently expects expense changes to refresh the chart:

    • Repeated expense additions, edits, and deletions must not request another chart search.
    • Expense changes behind an RHP, followed by closing it, must not request another chart search.
    • Initial load, actual Home return, chart changes, and reconnect must still fetch.
    • Equivalent query objects with an unchanged hash must not fetch.
    • Other Home cards must retain their existing live updates. Verify chart requests specifically, rather than counting all Home search requests.

    This proposal is based on code inspection; no changes or tests were run.

    What alternative solutions did you explore? (Optional)

    Throttling would still allow unwanted live updates. Changing the shared refresh hook or expense signature would affect other Home cards. Removing only the chart’s expense dependency keeps the change narrowly scoped.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/106791) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  3. mountiny commented on Nov 12, 2026

    @mountiny
    Contributor

    @MelvinBot implement this with unit test coverage

  4. self-assigned this
    on Nov 12, 2026
  5. MelvinBot commented on Nov 12, 2026

    @MelvinBot
    ContributorAuthor

    🤖 Web test steps verification results: ⚠️ partial

    Dev NewDot web verification was blocked: the handed-over session displayed a blank page. No runtime behavior could be verified.

    Blank dev NewDot page

    Step Status
    Home chart refresh behaviorThe page returned zero UI nodes, so initial load, expense updates, navigation, chart selection, reconnect, and RHP closure remain unverified.
    Blank dev NewDot page
    ❌
    Chart Search requestsNo recent network entries were available; request counts could not be assessed.
    ❌

    Implemented: Stop expense-driven Home Insights chart refreshes, opened as a draft and assigned to mountiny.

    Unit coverage: 177 tests passed across five focused suites, including expense-update suppression, RHP closure, and preserved refresh triggers. Lint, typecheck, spelling, direct compiler validation, and Storybook smoke testing passed.

    Limitations: Full Jest timed out after 10 minutes. Formatting and compiler changed-file checks were unavailable; details are recorded in the PR.


    view run · no recording available

  6. changed the title [-]Home - Stop live-updating the Insights chart on expense changes[/-] [+][$175] Home - Stop live-updating the Insights chart on expense changes[/+] on Nov 13, 2026
  7. melvin-bot commented on Nov 13, 2026

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions