Move ONYXKEYS.DERIVED.FLAGGED_EXPENSES into custom hook#94299
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
Already its working, but Im trying to make it depends on useFocus too so it will not run if have report open and send message |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0244e18d4e
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b88dcf6bdd
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ace44f3cd
ℹ️ 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".
|
@truph01 I think it's ready enough |
|
@Expensify/design @stephanieelliott No need for review, auto assignment because of merge issue |
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
truph01
left a comment
There was a problem hiding this comment.
Changes look good!
The failed jest unit test isn't related to this PR
b1603c6 to
891ce5a
Compare
|
All green here |
|
@LukasMod more conflicts |
|
@mountiny should be resolved |
…Expenses # Conflicts: # src/ONYXKEYS.ts # src/libs/actions/OnyxDerived/ONYX_DERIVED_VALUES.ts # src/types/onyx/DerivedValues.ts # src/types/onyx/index.ts
|
🚧 cristipaval 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/cristipaval in version: 9.4.26-0 🚀
|
|
🤖 No help site changes required. I reviewed the changes in this PR and no updates are needed to Expensify's help site files under Why: This is a pure performance refactor with no user-facing behavior change. It removes the The only help article that documents this feature — Understanding-the-For-you-Section.md — describes the Review item's behavior (flagged expenses on draft reports; Begin opens the first flagged expense to resolve the violation). None of that behavior changed, so the article remains accurate.
|
Removes the loginToAccountIDMap derived Onyx key and restores the pre-94784 Attendee type/shape. Resolves conflicts with Expensify#94299 by keeping the flaggedExpenses hook migration. Co-authored-by: Cursor <cursoragent@cursor.com>
|
🚀 Deployed to production by https://github.com/grgia in version: 9.4.27-2 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Removes the
flaggedExpensesOnyx derived value and moves its logic intouseReviewFlaggedExpenses, the only place that used it.The derived value ran app-wide for the entire session, rescanning all transactions on every change to the report/transaction/violation/policy collections, just to power one row on Home. Now that scan runs only while Home is mounted.
No behavior change - the "Review X expenses" row works exactly as before.
Additionally on Web, the Home tab stays mounted and reactive underneath the Inbox so I guarded flaggedExpenses recalculations with useIsHomeTabFocused
Fixed Issues
$ #94317
PROPOSAL:
Tests
Prerequisites: an employee account on a paid policy that flags expenses (e.g. categories required); access to two workspaces; This is a no-behavior-change refactor, so every result should match current production. I attached web video only as this change is more onyx-react related then platform specific.
Test 1: Review row appears with correct count
Prerequisite: create two expenses on Draft (OPEN) reports across two different workspaces, each with a missing-category violation.
Test 2: Begin opens the first flagged expense (wide layout)
Prerequisite: at least two flagged expenses on Draft reports; viewing on a wide screen.
Test 3: Begin opens the first flagged expense (narrow layout)
Prerequisite: at least one flagged expense on a Draft report; viewing on a narrow screen (mWeb or native).
Test 4: Count updates live as violations are resolved when screen is focused
Prerequisite: exactly two flagged expenses on Draft reports.
Test 5: Row is scoped to the current user's OPEN expense reports
Prerequisite: one flagged expense on your own Draft (OPEN) report; one flagged expense on a Submitted report; one flagged expense on a report you do not own.
Test 6: No flagged expenses renders no row
Prerequisite: an account with no flagged expenses on any Draft report.
Test 7: Survives fresh load, reconnect, and offline
Prerequisite: at least one flagged expense on a Draft report.
Offline tests
QA Steps
Same as tests
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.native.mov
Android: mWeb Chrome
android.web.mov
iOS: Native
ios.native.mov
iOS: mWeb Safari
ios.web.mov
MacOS: Chrome / Safari
Value updates when screen is focused, not when user change report in RHP:
Screen.Recording.2026-06-26.at.14.32.28.mov
Screen.Recording.2026-06-26.at.14.33.58.mov