Repository navigation
Remove Onyx.connect() key ONYXKEYS.COLLECTION.REPORT_ACTIONS in src/libs/OptionsListUtils.ts - part 3 - #86643
Conversation
|
@DylanDylann 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: 786f594285
ℹ️ 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".
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@MelvinBot Please check why we have Reassure Performance Tests / perf-tests (pull_request) Failing after 13m |
|
The Reassure perf test failure is not caused by this PR — it's a flaky/systemic issue currently affecting many unrelated PRs. Evidence
Root CauseThe baseline commit ( RecommendationRe-run the CI. If it continues to fail, the issue is in the baseline (main branch), not in this PR. |
|
PR doesn’t need product input as a refactor PR. Unassigning and unsubscribing myself. |
|
Let’s wait until the previous PR is merged |
|
@truph01 we got a failed check, please resolve it and ping the internal engineer to move it forward |
|
@DylanDylann All good now! |
|
@grgia This is ready for your review |
| loginList: OnyxEntry<Record<string, unknown>>; | ||
| policies: NonNullable<OnyxCollection<Policy>>; | ||
| visibleReportActionsData?: VisibleReportActionsDerivedValue; | ||
| sortedActions: Record<string, ReportAction[]> | undefined; |
There was a problem hiding this comment.
this hook still uses useSortedActions() later on, is that intentional?
There was a problem hiding this comment.
- if this is unused should it be a
?for not required?
There was a problem hiding this comment.
@grgia I removed that param entirely since, within hooks, we can directly use const sortedActions = useSortedActions();.
|
@grgia All good now! |
|
Ahh wait.... |
| const reportCache = iouReportID ? visibleReportActionsDataParam?.[iouReportID] : undefined; | ||
| const visibleReportActionsForIOUReport = reportCache && Object.keys(reportCache).length > 0 ? visibleReportActionsDataParam : undefined; | ||
| const iouReportActions = iouReportID ? deprecatedAllSortedReportActions[iouReportID] : undefined; | ||
| const iouReportActions = iouReportID ? sortedActions?.[iouReportID] : undefined; |
There was a problem hiding this comment.
@truph01 Could you investigate whether we can pass lastIOUMoneyReportAction instead of sortedActions?
There was a problem hiding this comment.
@DylanDylann Sorry, what do you mean by passing lastIOUMoneyReportAction instead of sortedActions?
Doesn't lastIOUMoneyReportAction depend on sortedActions?
There was a problem hiding this comment.
Yes, sortedActions is only used to get lastIOUMoneyReportAction
There was a problem hiding this comment.
@DylanDylann I don't think passing lastIOUMoneyReportAction instead of sortedActions is an improvement — it would violate DRY. The derivation still needs to happen somewhere, and moving it out of getLastMessageTextForReport means every call site must duplicate the same logic to compute it. Keeping it inside the function centralizes that in one place.
There was a problem hiding this comment.
sortedActions is a large object, and passing it across components can cause performance problems (triggering many renders when something in sortedActions changes). By passing a smaller parameter, we can help avoid unnecessary renders. Regarding DRY, we could also create a new hook to process lastIOUMoneyReportAction. Happy to discuss further before starting to make sure we're taking the best approach
There was a problem hiding this comment.
By passing a smaller parameter, we can help avoid unnecessary renders.
@DylanDylann However, to pass a smaller parameter, we still need to calculate it first. As a result, sortedActions still needs to be subscribed to in the component. Therefore, the number of renders does not change compared to passing sortedActions directly.
There was a problem hiding this comment.
@MelvinBot Could you explain the benefits of passing a small prop through a chain of child components? Especially in this case, where we can pass lastIOUMoneyReportAction instead of sortedActions
There was a problem hiding this comment.
|
Passing
In this specific case (line 714–724), |
|
🚧 @grgia has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/grgia in version: 9.3.79-1 🚀
Bundle Size Analysis (Sentry): |
|
I reviewed the changes in this PR. It's a purely internal code refactoring that threads a No help site documentation changes are required. |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.79-4 🚀
|
Explanation of Change
This is the 3rd PR in the migration of
Onyx.connect()forONYXKEYS.COLLECTION.REPORT_ACTIONSinOptionsListUtils. It refactors:Fixed Issues
$ #66381
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include ""[No QA].""
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-03-31.at.00.08.43.mov