Skip to content

[Due for payment 2026-01-21] [$125] Refactor putOnHold to use useAncestorReportsAndReportActions hook #73566

Closed

Description

@luacmartins

Problem

putOnHold uses getOptimisticDataForParentReportAction which is not a pure function and uses data retrieved via Onyx.connect, which can lead to the UI not re-rendering when it should.

Solution

Refactor putOnHold to use the new useAncestorReportsAndReportActions hook

cc @Tony-MK

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021983946450022250071
  • Upwork Job ID: 1983946450022250071
  • Last Price Increase: 2025-10-30
  • Automatic offers:
    • situchan | Contributor | 109508487
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @kadiealexander

Activity

  1. self-assigned this
    on Oct 27, 2025
  2. changed the title [-]Refactor putOnHold to use useAncestorReportsAndReportActions hook[/-] [+][$125] Refactor putOnHold to use useAncestorReportsAndReportActions hook[/+] on Oct 27, 2025
  3. melvin-bot commented on Oct 27, 2025

    @melvin-bot

    ⚠️ Could not update price automatically because there is no linked Upwork Job ID. The BZ team member will need to update the price manually in Upwork.

  4. FitseTLT commented on Oct 27, 2025

    @FitseTLT
    Contributor

    I can help as C+ based on the comment here

  5. bernhardoj commented on Oct 28, 2025

    @bernhardoj
    Contributor

    Just curious to know, is it important for action functions like putOnHold to be reactive?

    which can lead to the UI not re-rendering when it should.

    In my opinion, functions like putOnHold don't affect rendering, so it's fine to get the data from Onyx.connect (or Onyx.connectWithoutView).

    I agree it's not pure though, but passing the data from useOnyx hook means the component that uses putOnHold will unnecessarily re-render when the useAncestorReportsAndReportActions hook data changes

  6. luacmartins commented on Oct 28, 2025

    @luacmartins
    ContributorAuthor

    @bernhardoj you are right and I agree that it technically meets the bar for using connectWithoutView here, but I think from a bigger picture, we really want to promote the code using the best patterns.

    I think connectWithoutView is best used in src/lib files, and the src/action files should try to stick to pure functions as much as possible. This way, people don't see the Onyx.connect pattern in the action files and aren't as tempted to copy it to some other spot, or begin referencing the impure function without realizing it.

  7. bernhardoj commented on Oct 29, 2025

    @bernhardoj
    Contributor

    I think connectWithoutView is best used in src/lib files, and the src/action files should try to stick to pure functions as much as possible.

    Oh, interesting. I actually think it's fine to use connectWithoutView in src/actions because most of the functions don't care about reactivity and only care about the latest Onyx value (putOnHold, addComment, requestMoney, etc.). src/libs on the other hand, contains a lot of util functions that affect view rendering.

    aren't as tempted to copy it to some other spot, or begin referencing the impure function without realizing it.

    Maybe we can have a lint to only allow connectWithoutView usage under src/actions folders?

  8. luacmartins commented on Oct 29, 2025

    @luacmartins
    ContributorAuthor

    I think we should stick to the original philosophy in the docs and only allow connectWithoutView in certain /libs functions. This will set the right pure function pattern we want to start following.

  9. luacmartins commented on Oct 30, 2025

    @luacmartins
    ContributorAuthor

    @Tony-MK can you comment on this issue so I can assign it to you please?

  10. Tony-MK commented on Oct 30, 2025

    @Tony-MK
    Contributor

    @luacmartins, you can assign me.

  11. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 30, 2025
  12. melvin-bot commented on Oct 30, 2025

    @melvin-bot
  13. 45 remaining items

  14. changed the title [-][$125] Refactor putOnHold to use useAncestorReportsAndReportActions hook[/-] [+][Due for payment 2026-01-21] [$125] Refactor putOnHold to use useAncestorReportsAndReportActions hook[/+] on Jan 14, 2026
  15. melvin-bot commented on Jan 14, 2026

    @melvin-bot

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

  16. melvin-bot commented on Jan 14, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.1-1 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 2026-01-21. 🎊

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

  17. kadiealexander commented on Jan 21, 2026

    @kadiealexander
    Contributor

    Payment Summary

    @situchan please complete the checklist!

  18. situchan commented on Jan 21, 2026

    @situchan
    Contributor

    BugZero Checklist:

    • [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: This is migration so there's no offending PR

    • [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:

    • [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.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/591257

    Regression Test Proposal

    Test:

    1. Open any workspace chat.
    2. Create a manual expense.
    3. Navigate to "Reports" > "Reports"
    4. Long-tap and select the just-created expense.
    5. Tap on the dropdown menu.
    6. Tap on "Hold".
    7. Enter any reason and hold the expense.
    8. Verify that hold action is triggered.
    9. Open the expense report.
      10 Verify that the expense was held.

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-822a-a156-62b0-deba73abef74
  19. kadiealexander commented on Jan 21, 2026

    @kadiealexander
    Contributor

    @samarroy84 bump on applying via upwork here please!

  20. kadiealexander commented on Jan 26, 2026

    @kadiealexander
    Contributor

    @samarroy84 please let me know here when you've accepted the offer I sent across.

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 productionDailyKSv2ExternalAdded 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