You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-03-18] [$250] Expense - Modal remains open when select Duplicate expense #84237
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Version Number: v9.3.31-2 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#82005 Email or phone of affected tester (no customers):gocemate+b21549011@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Windows 10/Chrome App Component: Other
Please re-state the problem that we are trying to solve in this issue.
When a user opens an expense, taps "More", and selects "Duplicate expense", the dropdown menu stays open instead of closing after the action fires.
What is the root cause of that problem?
In MoneyRequestHeader.tsx, the shouldCloseModalOnSelect value for the DUPLICATE secondary action is set to true only when one of the blocking error conditions is active (distance expense unsupported, per diem on non-default workspace, or custom unit violation). In the normal flow where none of those conditions apply, the expression evaluates to false.
ButtonWithDropdownMenu passes each menu item's shouldCloseModalOnSelect directly to the PopoverMenu. In ButtonWithDropdownMenu's onItemSelected callback the modal is only hidden when selectedSubitem.shouldCloseModalOnSelect !== false. Since the normal duplicate case produces shouldCloseModalOnSelect: false, the setIsMenuVisible(false) call is skipped and the menu stays open.
What changes do you think we should make in order to solve the problem?
The fix is to change shouldCloseModalOnSelect on the DUPLICATE action to true unconditionally. The error-condition branches already return early before reaching the duplicateTransaction call, so there is no need to suppress modal close in the normal path. The same logic applies to MoneyReportHeader.tsx which has an identical pattern.
The error-condition paths (showConfirmModal calls) return early without calling duplicateTransaction, so closing the dropdown in all paths is correct. The confirm modal that pops up for error states will still open normally after the dropdown closes.
What alternative solutions did you explore? (Optional)
For a normal expense (no error conditions), all flags are false, so shouldCloseModalOnSelect evaluates to false. This triggers a strict-equality check in PopoverMenu.selectItem() (PopoverMenu.tsx:324):
} else if (selectedItem.shouldCloseModalOnSelect === false) {
// Calls onSelected directly WITHOUT closing the modal
Additionally, ButtonWithDropdownMenu (index.tsx:272) also skips closing:
if (selectedSubitem.shouldCloseModalOnSelect !== false) {
setIsMenuVisible(false);
}
So both closing mechanisms are bypassed when shouldCloseModalOnSelect is exactly false. Every other action in the same menu (Hold, Split, Merge, Delete, etc.) does not set shouldCloseModalOnSelect at all — it defaults to undefined, which does not match === false, so those actions properly close the modal via the shouldCallAfterModalHide branch.
The intent of shouldCloseModalOnSelect was to keep the popover open when an error modal needs to display (e.g., unsupported distance expense). But because it's set to the OR of the error booleans, the normal (no-error) case gets false instead of undefined, and false === false triggers the no-close branch.
What changes do you think we should make in order to solve the problem?
Remove the shouldCloseModalOnSelect property from the DUPLICATE action in both MoneyRequestHeader.tsx and MoneyReportHeader.tsx.
When no error conditions apply, the action should use the default closing behavior (like every other action). When error conditions DO apply, the onSelected handler already returns early after showing the error modal — since shouldCallAfterModalHide: true is injected by ButtonWithDropdownMenu, the onSelected callback runs after the popover closes, so the error modals will still display correctly.
What alternative solutions did you explore? (Optional)
An alternative would be to invert the logic so shouldCloseModalOnSelect is explicitly set to true in the normal case and false only when an error modal should be shown (e.g., shouldCloseModalOnSelect: !(isDistanceExpenseUnsupportedForDuplicating || ...)). However, removing the property entirely is simpler and consistent with how every other action in the menu works.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
changed the title [-]Expense - Modal remains open when select Duplicate expense[/-][+][$250] Expense - Modal remains open when select Duplicate expense[/+]on Mar 5, 2026
Please re-state the problem that we are trying to solve in this issue.
When a user selects Duplicate expense from the expense “More” menu, the dropdown remains open instead of closing.
What is the root cause of that problem?
shouldCloseModalOnSelect for the Duplicate action is set to a boolean OR of “error conditions.” In the normal (no-error) path that expression evaluates to false, which explicitly tells PopoverMenu and ButtonWithDropdownMenunot to close the menu. This differs from other actions where the property is omitted and default close behavior runs.
What changes do you think we should make in order to solve the problem?
Keep the intent of the flag (only keep the menu open when an error modal is shown), but invert the boolean so the default path closes the menu. This preserves the original purpose while fixing the normal flow.
What alternative solutions did you explore? (Optional)
Remove shouldCloseModalOnSelect entirely for Duplicate so it falls back to default close behavior (consistent with other actions).
Set shouldCloseModalOnSelect: true unconditionally for Duplicate (simplest change, but less aligned with the original intent to keep the menu open for error cases).
When duplicating an expense, the modal that opens for selecting the duplicate target remains open after selection, requiring manual closure. This breaks the expected UX flow.
Root Cause: After expense duplication is selected and processed, the modal's onDismiss callback isn't being triggered or the modal state isn't being reset.
Solution
Find the duplicate expense modal component handler (likely in ExpenseDetailsModal or related component)
After successful duplication action, trigger modal dismiss/close
Verify modal state is properly reset in the action flow
Implementation Approach
Locate the duplicate action handler
Add modal close trigger after duplication completes
Ensure state management properly reflects modal closure
Test on staging to confirm modal closes
Expected Changes
1-2 files modified (modal logic + action handler)
~20-30 lines of code changes
No breaking changes to other components
Awaiting assignment. Ready to start once assigned on Upwork.
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.35-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@parasharrajat@mallenexpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: Not needed
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
melvin-bot commentedon Mar 5, 2026
Triggered auto assignment to @mallenexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.MobileMage commentedon Mar 5, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user opens an expense, taps "More", and selects "Duplicate expense", the dropdown menu stays open instead of closing after the action fires.
What is the root cause of that problem?
In
MoneyRequestHeader.tsx, theshouldCloseModalOnSelectvalue for the DUPLICATE secondary action is set totrueonly when one of the blocking error conditions is active (distance expense unsupported, per diem on non-default workspace, or custom unit violation). In the normal flow where none of those conditions apply, the expression evaluates tofalse.ButtonWithDropdownMenupasses each menu item'sshouldCloseModalOnSelectdirectly to thePopoverMenu. InButtonWithDropdownMenu'sonItemSelectedcallback the modal is only hidden whenselectedSubitem.shouldCloseModalOnSelect !== false. Since the normal duplicate case producesshouldCloseModalOnSelect: false, thesetIsMenuVisible(false)call is skipped and the menu stays open.App/src/components/MoneyRequestHeader.tsx
Line 537 in 058eee1
What changes do you think we should make in order to solve the problem?
The fix is to change
shouldCloseModalOnSelecton the DUPLICATE action totrueunconditionally. The error-condition branches alreadyreturnearly before reaching theduplicateTransactioncall, so there is no need to suppress modal close in the normal path. The same logic applies toMoneyReportHeader.tsxwhich has an identical pattern.App/src/components/MoneyReportHeader.tsx
Lines 1540 to 1543 in 058eee1
The error-condition paths (
showConfirmModalcalls) return early without callingduplicateTransaction, so closing the dropdown in all paths is correct. The confirm modal that pops up for error states will still open normally after the dropdown closes.What alternative solutions did you explore? (Optional)
N/A
MelvinBot commentedon Mar 5, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user opens an expense, taps "More" and selects "Duplicate expense", the popover/dropdown menu remains open instead of closing.
What is the root cause of that problem?
The
shouldCloseModalOnSelectproperty on the DUPLICATE action is set to the boolean OR of error-condition flags:In
MoneyRequestHeader.tsx:537:In
MoneyReportHeader.tsx:1540-1544:For a normal expense (no error conditions), all flags are
false, soshouldCloseModalOnSelectevaluates tofalse. This triggers a strict-equality check inPopoverMenu.selectItem()(PopoverMenu.tsx:324):Additionally,
ButtonWithDropdownMenu(index.tsx:272) also skips closing:So both closing mechanisms are bypassed when
shouldCloseModalOnSelectis exactlyfalse. Every other action in the same menu (Hold, Split, Merge, Delete, etc.) does not setshouldCloseModalOnSelectat all — it defaults toundefined, which does not match=== false, so those actions properly close the modal via theshouldCallAfterModalHidebranch.The intent of
shouldCloseModalOnSelectwas to keep the popover open when an error modal needs to display (e.g., unsupported distance expense). But because it's set to the OR of the error booleans, the normal (no-error) case getsfalseinstead ofundefined, andfalse === falsetriggers the no-close branch.What changes do you think we should make in order to solve the problem?
Remove the
shouldCloseModalOnSelectproperty from the DUPLICATE action in bothMoneyRequestHeader.tsxandMoneyReportHeader.tsx.When no error conditions apply, the action should use the default closing behavior (like every other action). When error conditions DO apply, the
onSelectedhandler already returns early after showing the error modal — sinceshouldCallAfterModalHide: trueis injected byButtonWithDropdownMenu, theonSelectedcallback runs after the popover closes, so the error modals will still display correctly.What alternative solutions did you explore? (Optional)
An alternative would be to invert the logic so
shouldCloseModalOnSelectis explicitly set totruein the normal case andfalseonly when an error modal should be shown (e.g.,shouldCloseModalOnSelect: !(isDistanceExpenseUnsupportedForDuplicating || ...)). However, removing the property entirely is simpler and consistent with how every other action in the menu works.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.melvin-bot commentedon Mar 5, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (
External)[-]Expense - Modal remains open when select Duplicate expense[/-][+][$250] Expense - Modal remains open when select Duplicate expense[/+]melvin-bot commentedon Mar 5, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022029421081061909391
marufsharifi commentedon Mar 5, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user selects
Duplicate expensefrom the expense “More” menu, the dropdown remains open instead of closing.What is the root cause of that problem?
shouldCloseModalOnSelectfor the Duplicate action is set to a boolean OR of “error conditions.” In the normal (no-error) path that expression evaluates tofalse, which explicitly tellsPopoverMenuandButtonWithDropdownMenunot to close the menu. This differs from other actions where the property is omitted and default close behavior runs.What changes do you think we should make in order to solve the problem?
Keep the intent of the flag (only keep the menu open when an error modal is shown), but invert the boolean so the default path closes the menu. This preserves the original purpose while fixing the normal flow.
What alternative solutions did you explore? (Optional)
shouldCloseModalOnSelectentirely for Duplicate so it falls back to default close behavior (consistent with other actions).shouldCloseModalOnSelect: trueunconditionally for Duplicate (simplest change, but less aligned with the original intent to keep the menu open for error cases).yyyhakuna commentedon Mar 5, 2026
Proposal
Problem Analysis
When duplicating an expense, the modal that opens for selecting the duplicate target remains open after selection, requiring manual closure. This breaks the expected UX flow.
Root Cause: After expense duplication is selected and processed, the modal's onDismiss callback isn't being triggered or the modal state isn't being reset.
Solution
Implementation Approach
Expected Changes
Awaiting assignment. Ready to start once assigned on Upwork.
24 remaining items
melvin-bot commentedon Mar 11, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.35-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-03-18. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Mar 11, 2026
@parasharrajat @mallenexpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
mallenexpensify commentedon Mar 17, 2026
Payment Summary
Contributor+: @parasharrajat due $250 via NewDot
@parasharrajat plz complete the BZ checklist and tag me in a post once you have. Thx
parasharrajat commentedon Mar 18, 2026
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: [Duplicate Expenses] Re-enable Distance Expense Support with fixes #82005 (comment)
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: Not needed
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/613559
Regression Test Proposal
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-ae3b-a1ca-8ea6-05742884e0f4parasharrajat commentedon Mar 18, 2026
done @mallenexpensify
melvin-bot commentedon Mar 18, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Mar 18, 2026
Thanks Rajat
parasharrajat commentedon Apr 20, 2026
Payment requested as per #84237 (comment)
garrettmknight commentedon Apr 23, 2026
$250 approved for @parasharrajat