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 2025-04-14] [$250] Expense - Pay Elsewhere button returns to Pay with expensify if editing any field in report. #58688
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: 9.1.15-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers):ibellicotest+421@gmail.com Issue reported by: Applause Internal Team Device used: Motorola MotoG60 - Android 12 - Chrome / Windows 10 - Chrome App Component: Money Requests
Action Performed:
Open the staging.new.expensify.com website.
Open any workspace chat (Add approvals and Delay submissions are disabled).
Create an expense.
Open the expense report and tap on the dropdown menu on the pay button.
Select "Pay Elsewhere"
Edit any field on the report. (For example: Merchant)
When redirected to report again, check the pay button behaviour after this action.
Expected Result:
"Pay Elsewhere" option should remain the same after editing any of the fields in expense report.
Actual Result:
"Pay Elsewhere" option in expense report gets reseted to "Pay with Expensify" after editing any field of the report for the first time.
changed the title [-]Expense - Pay Elsewhere button returns to Pay with expensify if editing any field in report.[/-][+][$250] Expense - Pay Elsewhere button returns to Pay with expensify if editing any field in report.[/+]on Mar 19, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-03-19 15:10:00 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Expense - Pay Elsewhere button returns to Pay with expensify if editing any field in report.
What is the root cause of that problem?
When editing any field in the report, paymentButtonOptions is re-rendered. During this process, we re-sort the options to ensure the lastPaymentMethod is always at the top. And, in ButtonWithDropdownMenu, the selectedItemIndex still keep the same previous, causing the selected button to reset.
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.23-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@DylanDylann@laurenreidexpensify@DylanDylann 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]
1a. Result of the original design (eg. a case wasn't considered)
1b. Mistake during implementation
1c. Backend bug
1z. Other:
Where bug was reported:
2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
2b. Reported on staging (eg. found during regression or PR testing)
2d. Reported on a PR
2z. Other:
Who reported the bug:
3a. Expensify user
3b. Expensify employee
3c. Contributor
3d. QA
3z. Other:
[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:
[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:
[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.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
1a. Result of the original design (eg. a case wasn't considered)
1b. Mistake during implementation
1c. Backend bug
1z. Other:
Where bug was reported:
2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
2b. Reported on staging (eg. found during regression or PR testing)
2d. Reported on a PR
2z. Other:
Who reported the bug:
3a. Expensify user
3b. Expensify employee
3c. Contributor
3d. QA
3z. Other:
[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: I am not sure if this is a bug while implementing, it seems like a case wasn't considered
[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: NA
[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:
Regression Test Proposal
Test:
Open any workspace chat (Add approvals and Delay submissions are disabled).
Create an expense.
Open the expense report and tap on the dropdown menu on the pay button.
Select "Pay Elsewhere"
Edit any field on the report. (For example: Merchant)
When redirected to report again, check the pay button behaviour after this action.
Verify that: "Pay Elsewhere" option should remain the same after editing any of the fields in expense report.
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 19, 2025
Triggered auto assignment to @laurenreidexpensify (
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.[-]Expense - Pay Elsewhere button returns to Pay with expensify if editing any field in report.[/-][+][$250] Expense - Pay Elsewhere button returns to Pay with expensify if editing any field in report.[/+]melvin-bot commentedon Mar 19, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021902359061805797787
melvin-bot commentedon Mar 19, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (
External)linhvovan29546 commentedon Mar 19, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-03-19 15:10:00 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Expense - Pay Elsewhere button returns to Pay with expensify if editing any field in report.
What is the root cause of that problem?
When editing any field in the report,
paymentButtonOptionsis re-rendered. During this process, we re-sort the options to ensure thelastPaymentMethodis always at the top. And, inButtonWithDropdownMenu, theselectedItemIndexstill keep the same previous, causing the selected button to reset.App/src/components/SettlementButton/index.tsx
Lines 218 to 220 in 1c070f0
App/src/components/ButtonWithDropdownMenu/index.tsx
Line 54 in 1c070f0
What changes do you think we should make in order to solve the problem?
We can update
selectedItemIndeximmediately after sorting buttonOptions.App/src/components/ButtonWithDropdownMenu/index.tsx
Line 68 in 1c070f0
Pass a ref to ButtonWithDropdownMenu in SettlementButton.
Update
selectedItemIndexafter sortingbuttonOptions.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
We can write unit test to verify the button not change when re re-ender the paymentButtonOptions
What alternative solutions did you explore? (Optional)
linhvovan29546 commentedon Mar 19, 2025
Proposal updated
nkdengineer commentedon Mar 19, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
"Pay Elsewhere" option in expense report gets reseted to "Pay with Expensify" after editing any field of the report for the first time.
What is the root cause of that problem?
Test branch: https://github.com/nkdengineer/App/tree/fix/58688
paymentButtonOptionsis re-rendered when we edit a field of the transaction. The reason it's rendered is we add the whole report as dependency:confirmPaymentfunction which is theonPresscallback has some frequently changed dependencieschatReportandmoneyRequestReportApp/src/components/MoneyReportHeader.tsx
Lines 247 to 267 in 1c070f0
useMemoofpaymentButtonOptionsalso has some frequently changed dependenciesiouReport,chatReportApp/src/components/SettlementButton/index.tsx
Line 227 in 1c070f0
What changes do you think we should make in order to solve the problem?
chatReportandmoneyRequestReport. Also, we can adduseMemoforisAnyTransactionOnHoldandisDelegateAccessRestrictedApp/src/components/MoneyReportHeader.tsx
Lines 247 to 267 in 1c070f0
iouReportandchatReportare only used to check as a boolean so we can create a variable for this and add this as a dependency insteadApp/src/components/SettlementButton/index.tsx
Line 101 in 1c070f0
App/src/components/SettlementButton/index.tsx
Line 158 in 1c070f0
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Just is a UI logic improvement, no need the test.
What alternative solutions did you explore? (Optional)
We can store
lastPaymentMethodto a ref when the component is rendered and don't change it anymoreApp/src/components/SettlementButton/index.tsx
Lines 218 to 220 in a5be1a5
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
nkdengineer commentedon Mar 21, 2025
Updated proposal: Add alternative solution.
22 remaining items
melvin-bot commentedon Apr 7, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.23-7 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 2025-04-14. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Apr 7, 2025
@DylanDylann @laurenreidexpensify @DylanDylann 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]
laurenreidexpensify commentedon Apr 14, 2025
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:
[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:
[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.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
laurenreidexpensify commentedon Apr 14, 2025
@DylanDylann pls complete check list thanks
melvin-bot commentedon Apr 18, 2025
@laurenreidexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
DylanDylann commentedon Apr 21, 2025
Sorry for my delay. I missed the notification
DylanDylann commentedon Apr 21, 2025
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: I am not sure if this is a bug while implementing, it seems like a case wasn't considered
[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: NA
[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:
Regression Test Proposal
Test:
Do we agree 👍 or 👎
melvin-bot commentedon Apr 22, 2025
@laurenreidexpensify 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
laurenreidexpensify commentedon Apr 22, 2025
Payment Summary: