Skip to content

[Due for payment 2025-07-10] [$250] MED Refactor ShowContextMenuContext to pass isReportArchived instead of rNVPs #64933

Closed

Description

@tgolen

Problem

Coming from here

ShowContextMenuContext includes reportNameValuePairs for the purpose of some components detecting if a report is archived or not. We have been refactoring code to reduce the rNVPs from being passed around in so many different contexts. It is hard to keep track of.

Solution

Refactor ShowContextMenuContext so that instead of passing reportNameValuePairs, pass a boolean for isReportArchived instead.

Please be sure to update all places the context is used, as well as writing unit tests to ensure the context is including the isReportArchived boolean properly.

cc @DylanDylann

Issue OwnerCurrent Issue Owner: @
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021938258002535797470
  • Upwork Job ID: 1938258002535797470
  • Last Price Increase: 2025-06-26
  • Automatic offers:
    • thelullabyy | Contributor | 107834160
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @sakluger
Issue OwnerCurrent Issue Owner: @DylanDylann
Issue OwnerCurrent Issue Owner: @DylanDylann
Issue OwnerCurrent Issue Owner: @DylanDylann

Activity

  1. self-assigned this
    on Jun 25, 2025
  2. added
    Daily
    Bug
    on Jun 25, 2025
  3. melvin-bot commented on Jun 25, 2025

    @melvin-bot

    Triggered auto assignment to @sakluger (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.

  4. tgolen commented on Jun 25, 2025

    @tgolen
    ContributorAuthor

    @DylanDylann If you comment on this, I'll assign it to you so you can be the C+ on this one since you and I have been working with these and have the most context.

  5. thelullabyy commented on Jun 25, 2025

    @thelullabyy
    Contributor

    Proposal

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

    Refactor ShowContextMenuContext to pass isReportArchived instead of rNVPs

    What is the root cause of that problem?

    Improvement

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

    Update the ShowContextMenuContext type to replace reportNameValuePairs with isReportArchived boolean.

    reportNameValuePairs: OnyxEntry<ReportNameValuePairs>;

    • We should update all places that are using ShowContextMenuContext to pass the isReportArchived to the context value instead of reportNameValuePairs. We can get isReportArchived with useReportIsArchived hook

    • For each place that's using ShowContextMenuContext.Consumer check the use of reportNameValuePairs and replace this with isReportArchived.

    showContextMenuForReport(event, anchor, report?.reportID, action, checkIfContextMenuActive, ReportUtils.isArchivedNonExpenseReport(report, reportNameValuePairs));

    Most of these places are passing reportNameValuePairs to isArchivedNonExpenseReport, we can refactor this function with isReportArchived param

    function isArchivedNonExpenseReport(report: OnyxInputOrEntry<Report> | SearchReport, isReportArchived = false): boolean {
        return !(isExpenseReport(report) || isExpenseRequest(report)) && isReportArchived;
    }
    

    App/src/libs/ReportUtils.ts

    Lines 2050 to 2052 in 7ca08dc

    function isArchivedNonExpenseReport(report: OnyxInputOrEntry<Report> | SearchReport, reportNameValuePairs?: OnyxInputOrEntry<ReportNameValuePairs>): boolean {
    return !(isExpenseReport(report) || isExpenseRequest(report)) && !!reportNameValuePairs?.private_isArchived;
    }

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

    NA

    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.

  6. DylanDylann commented on Jun 25, 2025

    @DylanDylann
    Contributor

    @tgolen I would love to take over this issue as C+

  7. thelullabyy commented on Jun 25, 2025

    @thelullabyy
    Contributor

    Please be sure to update all places the context is used, as well as writing unit tests to ensure the context is including the isReportArchived boolean properly.

    @tgolen what is the test we need here? After we update ShowContextMenuContext type that will ensure that the context value will include isReportArchived boolean.

  8. changed the title [-]Refactor `ShowContextMenuContext` to pass `isReportArchived` instead of rNVPs[/-] [+]MED Refactor `ShowContextMenuContext` to pass `isReportArchived` instead of rNVPs[/+] on Jun 25, 2025
  9. DylanDylann commented on Jun 25, 2025

    @DylanDylann
    Contributor

    @tgolen Should we externalize this issue to the contributor?

  10. tgolen commented on Jun 25, 2025

    @tgolen
    ContributorAuthor

    Should we externalize this issue to the contributor?

    Yeah, but that's what @sakluger will do as the BZ person I believe.

  11. added
    External
    on Jun 26, 2025
  12. 22 remaining items

  13. melvin-bot commented on Jul 3, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.74-10 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-07-10. 🎊

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

  14. melvin-bot commented on Jul 3, 2025

    @melvin-bot

    @DylanDylann @sakluger 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]

  15. added
    Daily
    and removed
    Weekly
    on Jul 10, 2025
  16. sakluger commented on Jul 10, 2025

    @sakluger
    Contributor

    Hey @DylanDylann, could you please complete the BZ checklist here?

  17. sakluger commented on Jul 10, 2025

    @sakluger
    Contributor

    Summarizing payment on this issue:

    Contributor: @thelullabyy $250, paid via Upwork
    Contributor+: @DylanDylann $250, please request on Newdot

  18. DylanDylann commented on Jul 13, 2025

    @DylanDylann
    Contributor

    This is a refactor, I think we don't need to checklist here

  19. melvin-bot commented on Jul 14, 2025

    @melvin-bot

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

  20. sakluger commented on Jul 15, 2025

    @sakluger
    Contributor

    Got it, thanks! I removed the hold, please feel free to request payment.

  21. JmillsExpensify commented on Oct 14, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @DylanDylann

  22. quinthar commented on Oct 16, 2025

    @quinthar
    Contributor

    Approved $250 to @DylanDylann

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions