Remove Onyx.connect() for the key: ONYXKEYS.PERSONAL_DETAILS_LIST in src/libs/ReportNameUtils.ts - #97785
Conversation
Drop the module-level `Onyx.connect()` on `ONYXKEYS.PERSONAL_DETAILS_LIST` in `ReportNameUtils.ts` as part of the Onyx.connect deprecation migration (Expensify#76425). Personal details are now threaded explicitly: - `getMoneyRequestReportName` takes a required `personalDetailsList` param and resolves the invoice receiver's detail internally. - `getInvoiceReportName` / `getInvoicePayerName` accept the resolved detail/list as params (required args reordered ahead of optional ones). - `getChatListItemReportName` in ReportUtils receives `personalDetailsList` from its only caller, `SearchActionHeader`, via `useOnyx`. This removes a hidden global dependency so report-name computation is a pure function of its inputs. `getParentNavigationSubtitle` keeps using ReportUtils' own `allPersonalDetails` global (tracked separately, out of scope here). Tests updated to pass personal details explicitly, including a regression test covering the invoice payer-name resolution chain.
…Name Make the `personalDetails` param mandatory (key required, value may be undefined) so the compiler rejects any caller that omits it. Prevents a silent blank individual-receiver name now that the `allPersonalDetails` global fallback is gone.
The individual-invoice-receiver personal-detail resolution was duplicated in `getMoneyRequestReportName` (ReportNameUtils) and `getParentNavigationSubtitle` (ReportUtils). Extract it into a shared `getInvoiceReceiverPersonalDetail(report, personalDetailsList)` helper next to `getInvoiceReceiverPolicyID`, and reuse it in both call sites. Add unit specs covering individual, business, missing-account, and empty-input cases.
Trim the verbose test title and drop the implementation-detail comment on the threaded-chain invoice payer-name test; the assertion already documents the behavior.
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@shubham1206agra Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 741ef0a72a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
SearchActionHeaderContent renders per report-action list item, so `useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST)` opened a separate full-list subscription for every row. Switch to the shared `usePersonalDetails()` hook from OnyxListItemProvider — the optimized single-subscription access pattern for list items — avoiding the per-row memory overhead and update cascades.
|
PR doesn’t need product input as a refactor PR. Unassigning and unsubscribing myself. |
Reviewer Checklist
Screenshots/VideosScreen.Recording.2026-08-06.at.5.32.20.PM.mov |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #76425 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
@hoangzinh conflicts. |
I resolved conflicts @rlinoz |
Explanation of Change
Removes Onyx.connect() on ONYXKEYS.PERSONAL_DETAILS_LIST in src/libs/ReportNameUtils.ts as part of the Onyx.connect deprecation migration (parent: Expensify/Expensify#522215).
Instead of reading personal details from a JS in mem, they are now threaded explicitly through the report-name computation. This makes report-name computation a pure function of its inputs.
Fixed Issues
$ #76425
PROPOSAL:
Tests
Same as QA
Offline tests
Same as QA
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Screen.Recording.2026-08-04.at.21.59.50.mov