Skip to content

[Due for payment][$250] Remove call to getReportNameValuePairs() in canEditRoomVisibility() #64013

Description

@tgolen

Coming from #59961

Problem

canEditRoomVisibility() is not a pure function because it references the report's NVPs from a global variable here. This is an anti-pattern that we are actively trying to unwind.

Solution

Using test driven development:

  1. Make sure a unit test exists for canEditRoomVisibility() in its current form (or create one if it doesn't exist)
  2. Refactor canEditRoomVisibility() to be a pure function, adding isReportArchived = false as a new parameter
  3. Implement the new parameter in all code that calls canEditRoomVisibility()
  4. Ensure the unit tests still pass

Important

Please be sure that your proposal follows these best practices:

  • Don't add any more references to data obtained via Onyx.connect
  • Don't add any more references to isArchivedReport(nameValuePairs) unless absolutely necessary
  • Focus on connecting to the data in a UI component and passing the data all the way down with params
  • The React hook useReportIsArchived() is very useful for these
  • Look for existing references in the functions for the report's NVPs or see if isReportArchived has already been passed or calculated
Issue OwnerCurrent Issue Owner: @
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021945234426116211782
  • Upwork Job ID: 1945234426116211782
  • Last Price Increase: 2025-07-15
Issue OwnerCurrent Issue Owner: @

Activity

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributorsHelpDotApply this label if the issue relates to ExpensifyHelpReviewingHas a PR in review

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions