fix: close popover after duplicating expense#84024
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
self-review / code walkthrough the bug is in how in shouldCloseModalOnSelect: hasCustomUnitOutOfPolicyViolation || isPerDiemRequestOnNonDefaultWorkspace,in shouldCloseModalOnSelect: isPerDiemRequestOnNonDefaultWorkspace || hasCustomUnitOutOfPolicyViolation || activePolicyExpenseChat?.iouReportID === moneyRequestReport?.reportID,the problem: in the normal case (no violations), the OR evaluates to the fix is wrapping each in the violation handlers (lines 493-510 in MoneyRequestHeader) call Delete action works fine because it doesn't set |
|
@ahmedGaber93 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] |
|
bug reproduction (production, new.expensify.com): bug-demo-final.mp4three-dot menu stays open after clicking Duplicate expense. popover should dismiss on click. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc0242ed10
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@tgolen ready for review. codex caught one thing and it's been addressed, clean on re-review now. |
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
b5d1eeb to
9d042fc
Compare
a6a4d45 to
c8cd88f
Compare
trjExpensify
left a comment
There was a problem hiding this comment.
Makes sense to close the popover 👍
c8cd88f to
90db6d8
Compare
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp20260310210032317.mp420260310205857342.mp4Android: mWeb Chrome20260310211420777.mp420260310211538629.mp4iOS: HybridAppiOS: mWeb Safari20260310211859640.mp4MacOS: Chrome / Safari20260310202856074.mp420260310203013222.mp420260310203211158.mp4 |
|
@tgolen Sorry for joining this late 🙏 I just want to confirm that this is being discussed in the correct context. CC @trjExpensify Based on #65948 (OP item 4), we intentionally kept the menu open on success for displaying success animation, and on failure we close it and show an error alert.
Now in this PR we are reverting that behavior. If we close the menu immediately after clicking, the animation above will no longer be visible, so it probably makes sense to remove that implementation as well. Also, there’s no longer a need to keep |
|
OK, that's good context to know. Thank you! I didn't know about that. I personally feel like leaving the menu open, solely for the purpose of showing the animation, isn't a very good UX. I would suggest we remove the animation and close the menu. Looking for @trjExpensify to confirm what we would like to do here. |
|
I thought the original implementation of this had the popover close after the success animation? But yeah, I can see on staging that isn't happening: 2026-03-06_10-14-36.mp4Can we do that? I do think you need some kind of confirmation that the action was successful otherwise it just feels like a dead click in the popover. (CC: @Expensify/design @garrettmknight for vis) |
|
@trjExpensify got it, so the flow you want is: click Duplicate → success animation plays (checkmark + "Duplicated" text) → popover auto-closes after the animation finishes. right now my PR just closes the popover immediately on click, which skips the animation entirely. i'll update it to keep the popover open during the animation and then close it once the animation completes. just want to confirm before i start: are we waiting on @garrettmknight / @Expensify/design to weigh in, or should i go ahead with the "animate then close" approach? |
|
@tgolen I also agree that the hard-coded delay isn't ideal. However, since the current animation relies on That said, this is only a minor improvement, so I'm also fine with closing this PR. |
|
What we can do is that we allow a passing handler to the throttle hook. Then, when we reset the state of the button after a timeout, we first call the handler(which closes the modal in our case), then we reset the button state. |
|
Ahh, this looks like a better approach. @yuvrajangadsingh can we try implementing this? |
|
@ahmedGaber93 @parasharrajat done. pushed in 027552b. removed the no extra props, no extra timers. the popover closes exactly when the animation finishes, driven by the same 1800ms timeout that already existed in the hook. |
tgolen
left a comment
There was a problem hiding this comment.
Looks good to me! Thanks for those improvements.
e3b0a1a to
3e039d3
Compare
Keep popover open during the success animation (checkmark + "Duplicated" text), then auto-close after 1.5s. Matches the pattern used in Inbox context menu actions like "Copy link". Reverts shouldCloseModalOnSelect to original logic: close immediately for error cases, stay open for success animation then delayed close.
add shouldDelay to PopoverMenuItem type. when true, the popover closes after 800ms delay (same as ReportActionContextMenu pattern) instead of calling closeModal() which could close the wrong modal.
… shouldDelay removes the hardcoded setTimeout delay from PopoverMenu and the shouldDelay prop from DropdownOption. instead, useThrottledButtonState now accepts an optional onReset callback that fires when the button state resets after the animation, closing the popover at the right time without any extra timers or props.
3e039d3 to
8dcd76c
Compare
|
Tested it, works like a charm 👍 20260316192952771.mp4 |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #83708 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
@tgolen All yours! |
|
🚧 @tgolen 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/tgolen in version: 9.3.39-0 🚀
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.39-3 🚀
|
Explanation of Change
The
shouldCloseModalOnSelectprop on the Duplicate action was inverted. In the normal case (no violations), the OR expression evaluated tofalse, keeping the popover open.PopoverMenuchecksshouldCloseModalOnSelect === false(strict equality), sofalse= keep open.Negated the condition in both
MoneyRequestHeaderandMoneyReportHeaderso the popover closes by default and only stays open when a violation error modal needs to show.Fixed Issues
$ #83708
PROPOSAL: #83708 (comment)
Tests
Offline tests
N/A, this is a UI state fix. The
shouldCloseModalOnSelectboolean is evaluated synchronously when the menu item is tapped, no network calls involved.QA Steps
Same as tests above.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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
MacOS: Chrome / Safari
Bug (production):
bug-demo-final.mp4
popover stays open after clicking "Duplicate expense" from the three-dot menu.
Fix: negated
shouldCloseModalOnSelectso the popover closes on duplicate. same flow, menu dismisses immediately.Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari