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
[HOLD for payment 2023-10-10] [HOLD for payment 2023-10-09] [$500] Android-IOU-Distance IOU amount is auto-filled and displayed in manual request money page #26945
Please re-state the problem that we are trying to solve in this issue.
IOU amount is autofilled and displayed in manual request page when editing Distance request.
What is the root cause of that problem?
The amount prop for the MoneyRequestAmountForm component on NewRequestAmountPage is set to iou.amount which retrieves the saved amount from Onyx.
What changes do you think we should make in order to solve the problem?
Solution 1
Conditionally set the amount prop for MoneyRequestAmountForm on NewRequestAmountPage based on the isEditing flag. This is based on the assumption that every new money request should have the initial value as 0. On the other hand, if the value is being edited, it should pick up the Onyx data.
Solution 2
Clear the iou from Onyx when the user navigates away from the Distance request page, or when the NewRequestAmountPage comes into focus.
Solution 3
Do not set the amount prop value for MoneyRequestAmountForm on NewRequestAmountPage if the page is not in focus. We can use a state variable and then make use of the useIsFocused navigation hook to check this.
What alternative solutions did you explore? (Optional)
The problem is that when the manual data tab renders, the new amount value has not yet been reset in Onyx. When it is reset, we do not change the amount since there is a condition returning early if !amount:
What alternative solutions did you explore? (Optional)
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.
Also as per this comment we want to clear the data when we switch between request types: #26579 (comment)
We still want to reset the money request information because we are sharing the data for a draft money request. If we don't clear the data when a different tab/request type is selected, draft data from the previous type might be included in the new money request.
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:
A discussion in #expensify-bugs 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:
No need for additional discussion
Determine if we should create a regression test for this bug.
Up to the QA team
If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
Launch the app.
Tap the Floating Action Button (FAB).
Select the 'Request Money' option.
Access the 'Distance' feature.
Click on 'Start' and choose a specific address.
Click on 'Finish' and designate a different address.
Proceed by tapping 'Next'.
Choose your preferred workspace.
Take note of the 'Request Money' amount displayed.
Navigate back to the 'Request Money' page.
Select the 'Manual' option.
Confirm that no amount is set (you should see a slightly greyed-out 0)
My mistake, I missed that there was a regression here but was addressed quickly. I need another day to review and confirm the payment amounts. For now, I've paid the reporter.
*If applicable, the bonuses will be applied on the final payment
Extra Notes regarding payment: This GH would fall under an urgency bonus but due to regression there won't be one. We did fix the issue quickly, so I'll be keeping the base pay as is for the contributors.
Activity
melvin-bot commentedon Sep 7, 2023
Triggered auto assignment to @alexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Sep 7, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)akinwale commentedon Sep 7, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
IOU amount is autofilled and displayed in manual request page when editing Distance request.
What is the root cause of that problem?
The
amountprop for theMoneyRequestAmountFormcomponent on NewRequestAmountPage is set toiou.amountwhich retrieves the saved amount from Onyx.What changes do you think we should make in order to solve the problem?
Solution 1
Conditionally set the
amountprop forMoneyRequestAmountFormonNewRequestAmountPagebased on theisEditingflag. This is based on the assumption that every new money request should have the initial value as 0. On the other hand, if the value is being edited, it should pick up the Onyx data.Solution 2
Clear the iou from Onyx when the user navigates away from the Distance request page, or when the NewRequestAmountPage comes into focus.
Solution 3
Do not set the amount prop value for
MoneyRequestAmountFormonNewRequestAmountPageif the page is not in focus. We can use a state variable and then make use of the useIsFocused navigation hook to check this.What alternative solutions did you explore? (Optional)
None.
joh42 commentedon Sep 7, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
When we go to the manual money request tab after starting a distance request, the amount from the distance request remains.
What is the root cause of that problem?
We already reset the data when the tab changes:
App/src/pages/iou/MoneyRequestSelectorPage.js
Lines 64 to 67 in f67bf9f
The problem is that when the manual data tab renders, the new amount value has not yet been reset in Onyx. When it is reset, we do not change the amount since there is a condition returning early if
!amount:App/src/pages/iou/steps/MoneyRequestAmountForm.js
Lines 103 to 105 in f67bf9f
What changes do you think we should make in order to solve the problem?
I suggest we update the aforementioned condition so that we still set the amount if it is 0:
What alternative solutions did you explore? (Optional)
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.
joh42 commentedon Sep 7, 2023
Demo of my proposed solution:
Screen.Recording.2023-09-07.at.13.59.52.mov
joh42 commentedon Sep 7, 2023
Also as per this comment we want to clear the data when we switch between request types: #26579 (comment)
alexpensify commentedon Sep 8, 2023
I've run out of time today and will test soon.
alexpensify commentedon Sep 11, 2023
Still on my testing list
50 remaining items
jakub-trzebiatowski commentedon Oct 6, 2023
MoneyRequestConfirmPagefor Distance Request #25707MoneyRequestConfirmPagefor Distance Request #25707 (comment)alexpensify commentedon Oct 10, 2023
My mistake, I missed that there was a regression here but was addressed quickly. I need another day to review and confirm the payment amounts. For now, I've paid the reporter.
alexpensify commentedon Oct 12, 2023
Here is the payment summary:
Upwork Job: https://www.upwork.com/jobs/~01baf90b8cc8571594
*If applicable, the bonuses will be applied on the final payment
Extra Notes regarding payment: This GH would fall under an urgency bonus but due to regression there won't be one. We did fix the issue quickly, so I'll be keeping the base pay as is for the contributors.
alexpensify commentedon Oct 12, 2023
Everyone has been paid in Upwork. I need to create the regression test and will close it.
melvin-bot commentedon Oct 16, 2023
@cubuspl42, @marcochavezf, @alexpensify, @tienifr Whoops! This issue is 2 days overdue. Let's get this updated quick!
alexpensify commentedon Oct 16, 2023
Not overdue, I need to create the regression test.
jakub-trzebiatowski commentedon Oct 17, 2023
It's the opposite, but doesn't matter much I guess
alexpensify commentedon Oct 18, 2023
Alright, I updated the summary based on the @cubuspl42 feedback Also, I created the regression test, so I'm going to close this out.