Repository navigation
Stop hidden report action popovers from re-rendering - #105946
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34e3367a89
ℹ️ 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".
| if (isDeleteCommentConfirmModalVisible) { | ||
| return; | ||
| } | ||
|
|
||
| DeviceEventEmitter.emit(`deletedReportAction_${reportIDRef.current}`, reportAction?.reportActionID); | ||
| setIsDeleteCommentConfirmModalVisible(false); | ||
| }, [ | ||
| report, | ||
| reportActions, | ||
| originalReportActions, | ||
| childReportActions, | ||
| childParentReportAction, | ||
| childReport, | ||
| selfDMReport, | ||
| iouReport, | ||
| iouReportTransactions, | ||
| chatReport, | ||
| duplicateTransactions, | ||
| duplicateTransactionViolations, | ||
| isReportArchived, | ||
| isChatIOUReportArchived, | ||
| allTransactionViolations, | ||
| currentUserAccountID, | ||
| delegateAccountID, | ||
| deleteTransactions, | ||
| currentSearchHash, | ||
| email, | ||
| reportTransactions, | ||
| bankAccountList, | ||
| isOriginalReportArchived, | ||
| isOffline, | ||
| visibleReportActionsData, | ||
| iouTransaction, | ||
| iouOriginalTransaction, | ||
| iouPolicy, | ||
| getCurrencyDecimals, | ||
| ]); | ||
| setDeleteModalTarget(null); |
There was a problem hiding this comment.
Preserve a delete modal reopened during its exit
On Android, if a second delete is requested while the first confirmation's exit animation is still running, this closure still contains false: BaseModal explicitly documents that Reanimated's hide callback comes from the exit-animation snapshot (src/components/Modal/BaseModal.tsx:125-127), and that snapshot invokes the onModalHide supplied by the closed render. The check therefore falls through to setDeleteModalTarget(null) and removes the newly reopened confirmation; read the current visibility from a ref (or otherwise from current state) before clearing the target.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
the codex comment is right, i've implemented it adding a ref to keep the state in sync
|
Reviewing |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-11-05.at.11.49.12.movAndroid: mWeb ChromeScreen.Recording.2026-11-05.at.11.46.40.moviOS: HybridAppScreen.Recording.2026-11-05.at.11.40.06.moviOS: mWeb SafariScreen.Recording.2026-11-05.at.11.41.37.movMacOS: Chrome / SafariScreen.Recording.2026-11-05.at.11.37.45.mp4 |
iOS: renders on report openReact DevTools profiler, opening "Expense Report 2026-02-26" from the Inbox. 1 warmup + 3 profiled opens per branch, identical in all 3 opens.
iOS:
|
| Block | Samples | Mean | Median |
|---|---|---|---|
| PR-1 | 611 636 603 609 632 691 647 850 | 660 | 634 |
| main-1 | 638 637 704 641 659 693 653 779 | 676 | 656 |
| main-2 | 638 652 615 710 639 753 691 787 | 686 | 672 |
| PR-2 | 598 646 639 630 682 707 656 702 | 658 | 651 |
| Branch | n | Mean | Median | SD | Min | Max |
|---|---|---|---|---|---|---|
| main | 16 | 681 | 656 | 54 | 615 | 787 |
| PR | 16 | 659 | 642 | 61 | 598 | 850 |
PR is 22 ms (3.2%) faster on the mean and 14 ms (2.1%) on the median. Welch t = 1.07 and Mann-Whitney z = 1.62, so the difference is not statistically significant with 16 samples per branch, and it is lower than the 6-7% in the description.
|
@huult I've responded to Codex comment. You can continue |
|
🚧 roryabraham 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/roryabraham in version: 9.5.34-0 🚀
|
|
No help site update needed — this PR optimizes rendering while preserving existing deletion and emoji workflows, without introducing a new feature or making any existing article sentence incorrect. |
|
No FullStory changes needed — this PR only optimizes rendering and refactors existing deletion and emoji-picker workflows, without adding new interactions, screens, user-property values, or sensitive content. |
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.5.34-1 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
PopoverReportActionContextMenuis mounted for the whole app, but it read about 20 Onyx values that only the delete confirmation needs, such asVISIBLE_REPORT_ACTIONS,TRANSACTION_VIOLATIONS, the self DM report, transactions and policies. Their keys came from refs read during render, so the hidden menu, itsPopoverWithMeasuredContentand the hiddenConfirmModalre-rendered together with the report screen. Since manual memoization was removed in #104522, nothing stops those hidden popovers from rendering.This PR moves the delete-only reads and the delete logic into a new
useDeleteReportActionhook. Only the delete confirmation modal calls it, and that modal mounts only from the moment a delete is requested until it has finished hiding. The context menu shell no longer subscribes to Onyx at all. The comment delete still runs after the modal hides, so the row does not disappear under the closing modal. The hook hands that delete back to the menu throughdeleteAfterModalHide, because the menu owns the modal hide timing.EmojiPickerread three refs during render (the anchor, the anchor dimensions and the active emoji), which kept it from compiling with React Compiler. These are now state, so the file compiles and its manualuseCallbackcalls are gone.A new UI test checks that the confirmation is not mounted until a delete is requested, that a comment is deleted only after the modal hides, and that cancel deletes nothing.
Results (iOS 17 Pro simulator, dev build, ABBA with 8 blocks against main):
ManualOpenReportwent from 613 to 570 ms in an expense report and from 917 to 863 ms in the self DM.ManualNavigateToReportswent from 131 to 124 ms.PopoverReportActionContextMenuandConfirmModalwent from 3 renders to 0,PopoverWithMeasuredContentfrom 5 to 2, andBaseModal/ReanimatedModalfrom 10 to 7.EmojiPickernow compiles with React Compiler.Fixed Issues
$ #105951
PROPOSAL:
Tests
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari