Repository navigation
Description
Coming from Coming from here
Overview
The ModifiedExpenseMessage.ts file uses Onyx.connectWithoutView to maintain module-level state for allPolicyTags and currentUserLogin.
Current Architecture
The file uses module-level Onyx connections:
let allPolicyTags: OnyxCollection<PolicyTagLists> = {};
Onyx.connectWithoutView({
key: ONYXKEYS.COLLECTION.POLICY_TAGS,
// ...
});
let currentUserLogin = '';
Onyx.connectWithoutView({
key: ONYXKEYS.SESSION,
// ...
});These are used by getForReportAction() which is called from:
ReportActionItem.tsxContextMenuActions.tsxBrowserNotifications.tsOptionsListUtils/index.tsReportNameUtils.tsReportUtils.ts
Migration Plan
The goal is to make getForReportAction a pure function that receives policyTags and currentUserLogin as parameters from the call site.
PR 1: ReportActionItem.tsx + ContextMenuActions.tsx ✅
Status: In Progress (#80258)
- Add
useOnyxhooks to fetchpolicyTagsandsessionin React components - Use
getForReportActionTempwhich accepts all required parameters - Pass
translate,policy,policyTags, andcurrentUserLoginfrom components
PR 2: BrowserNotifications.ts
Scope: 1 file, straightforward
Browser notifications are non-UI code. We can pass empty/undefined values for parameters that aren't needed in notification context, or thread the values from where notifications are triggered.
PR 3: OptionsListUtils getLastMessageTextForReport
Scope: ~4-5 files
This function already accepts some parameters. We need to:
- Add
policyTagsandcurrentUserLoginparameters - Switch to the pure function version
- Update the 5 callers
PR 4: ReportNameUtils computeReportName
Scope: ~8-9 files
Similar approach:
- Add parameters to
computeChatThreadReportNameandcomputeReportName - Update 12 callers across 8 files
PR 5: Final Cleanup
Scope: 1 file
Once PRs 2-4 are complete:
- Remove
getForReportAction(old function) - Rename
getForReportActionTemp→getForReportAction - Remove the module-level Onyx connections
- Remove eslint-disable comments
What about ReportUtils.getReportName?
The deprecated getReportName function in ReportUtils.ts has 42 callers. Since it's already marked as deprecated (developers should use computeReportName instead), we don't need to actively migrate all those callers. Once PR 4 is done, the recommended function will be fully migrated.
Related PRs
- fix: migrate ReportActionItem to useOnyx for policyTags #80258 - PR 1: ReportActionItem.tsx + ContextMenuActions.tsx migration
Issue Owner
Current Issue Owner: @mallenexpensifyUpwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022036562798754115810
- Upwork Job ID: 2036562798754115810
- Last Price Increase: 2026-03-24
Activity
tgolen commentedon Jan 22, 2026
Thanks Marco! We need to go with Option A. We've been working for 4 months now to remove the anti-patterns of the "module-level state".
luacmartins commentedon Jan 22, 2026
I agree with Tim. We need to make any functions using
tagsandcurrentUserLoginpure functions and pass that data from the call site.marcochavezf commentedon Jan 22, 2026
Ok, thanks for the feedback! I updated the plan to gradually migrate it
linhvovan29546 commentedon Jan 23, 2026
Hello, coming from a small discussion here ! I think in this issue we only need to migrate the functions to accept a
currentUserLoginparameter forgetForReportActionandgetForReportActionTemp, and we should not replacegetForReportActionwithgetForReportActionTemp.The reason is that this issue #66336 #75562 is migrating to remove
POLICY_TAGS, so touching too much in this file would introduce hard conflictsmelvin-bot commentedon Jan 28, 2026
@marcochavezf Huh... This is 4 days overdue. Who can take care of this?
melvin-bot commentedon Jan 30, 2026
@marcochavezf 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
marcochavezf commentedon Feb 3, 2026
No update, we prioritized sprint projects last week, now I will prioritize this one again
parasharrajat commentedon Feb 5, 2026
We are working on a similar issue here #66336, which precedes this one.
55 remaining items
joekaufmanexpensify commentedon Mar 24, 2026
We discussed and think $500 each is fair here. Any concerns with that @linhvovan29546 @parasharrajat ?
joekaufmanexpensify commentedon Mar 24, 2026
Payment Summary
melvin-bot commentedon Mar 24, 2026
Current assignees @parasharrajat and @linhvovan29546 are eligible for the External assigner, not assigning anyone new.
[-][Due for payment 2026-03-24] Migrate ModifiedExpenseMessage.ts from Onyx.connect to useOnyx pattern[/-][+][$250] [Due for payment 2026-03-24] Migrate ModifiedExpenseMessage.ts from Onyx.connect to useOnyx pattern[/+]melvin-bot commentedon Mar 24, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022036562798754115810
joekaufmanexpensify commentedon Mar 24, 2026
@linhvovan29546 offer sent for $500
linhvovan29546 commentedon Mar 25, 2026
I've accepted the offer
mallenexpensify commentedon Mar 25, 2026
@linhvovan29546 paid, summary updated above. Thx.
parasharrajat commentedon Apr 20, 2026
Payment requested as per #80263 (comment)
garrettmknight commentedon Apr 23, 2026
$500 approved for @parasharrajat