Conversation
Decompose the 765-line monolith into focused hooks and components: - Extract 9 menu item hooks that each own their Onyx subscriptions - Add FABPopoverContent guard/inner pattern for lazy mount/unmount - Move dragover listener into the component, eliminating imperative ref - Simplify NavigationTabBarFloatingActionButton to a re-export - Move PolicySelector type to FABPopoverContent/types.ts
…eState for reportID
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.
|
…inating direct FABMenuContext usage from all menu items
|
I have failed to help you. I let you down and for that I am sorry. Please try again later. This may be due to a Claude outage (check here). Failure details: https://github.com/Expensify/Expensify/actions/runs/23216147996 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 83cded2df4
ℹ️ 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".
| setIsVisible(false); | ||
| Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: buildCannedSearchQuery({type: CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT})})); | ||
| }, [onCancel]); | ||
| const openCreateReportConfirmation = () => { |
There was a problem hiding this comment.
Memoize openCreateReportConfirmation
openCreateReportConfirmation is recreated on every render because it is a plain function, but callers like useSearchTypeMenuSections and NewReportWorkspaceSelectionPage invoke it from useEffect(..., [pending..., openCreateReportConfirmation]). When pending state is set, this opens the modal, which updates modal context and rerenders; the changed function identity retriggers the effect and opens the same modal again, causing repeated/stacked confirmations. This should be wrapped in useCallback with stable dependencies.
Useful? React with 👍 / 👎.
| const handleLinkPress = () => { | ||
| closeModal(); | ||
| Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: buildCannedSearchQuery({type: CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT})})); |
There was a problem hiding this comment.
Call onCancel when navigating from confirmation link
The link handler inside the confirmation prompt closes the modal and navigates, but it no longer triggers onCancel. Before this refactor, link clicks executed the cancel callback, and current callers rely on onCancel to clear pending state (pendingReportCreation / pendingPolicySelection); skipping it can leave stale pending state after navigating to Search and cause incorrect follow-up behavior when returning.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
imo Claude is right here, this is happening but implicitly in the promise chain.
The review comment is invalid.
The bot claims onCancel is no longer called when the link is pressed, but tracing the code shows it IS called:
handleLinkPress(line 72) callscloseModal()closeModal()inModalContext(line 68) defaults to{action: 'CLOSE'}and resolves the modal promise with that payload- Back in
useCreateEmptyReportConfirmation(lines 89-94), the.then()handler checksresult.action === ModalActions.CONFIRM— since it's'CLOSE', it falls into theelsebranch which callsonCancelRef.current?.()
So onCancel is triggered via the promise resolution path. The refactor replaced an explicit onCancel?.() call with an equivalent implicit one through the modal's promise-based API. The behavior is preserved.
|
Honestly I cannot reproduce this slight layout pivot on the quick action myself, no matter what combination I use. Best to hotfix this on staging unless @aimane-chnaif you can provide exact repro steps or can track this down for us? |
Tests were fine |
|
going to move it before more conflicts |
|
🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.3.40-0 🚀
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.3.40-0 🚀
|
|
Deploy Blocker ##85656 was identified to be related to this PR. |
|
Deploy Blocker ##85661 was identified to be related to this PR. |
|
Deploy Blocker ##85685 was identified to be related to this PR. |
[CP Staging] Fix FAB deploy blockers from popover decomposition (#83299)
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.41-4 🚀
|
Explanation of Change
Decomposes the monolithic
FloatingActionButtonAndPopover(~800 lines) into a composable architecture, following our Clean React coding standards AI skills.Each FAB menu item (Expense, Invoice, Travel, QuickAction, etc.) becomes a self-contained JSX component that fetches its own data, owns its visibility logic, and registers itself with a lightweight
FABMenuContextfor keyboard navigation.The parent shrinks from ~800 to ~80 lines of pure composition, and no manual memoization is used — React Compiler handles it all.
Fixed Issues
$ #84874
PROPOSAL:
Tests
1. FAB Button & Menu Open/Close
2. Menu Items Presence & Order
3. Always-Visible Items
4. Quick Action (conditional)
5. Conditional Items
6. Keyboard Navigation
7. Quick Scan (Long Press / Receipt Button)
8. Narrow vs Wide Layout
9. Create Report with Empty Report Confirmation
10. Redirect to Expensify Classic
On account where ALL group policies have expense chat disabled, click "Create expense" — confirmation modal appears offering redirect to Expensify Classic
Confirm redirect on web — opens Expensify Classic in same tab
Verify that no errors appear in the JS console
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.mp4
Android: mWeb Chrome
iOS: Native
ios.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mp4