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-23] [HOLD for payment 2023-10-23] [$500] Request money - Description briefly displayed in preview after adding a receipt from a manual request #28380
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
changed the title [-]Request money - Description briefly displayed in preview after adding a receipt from a manual request[/-][+][$500] Request money - Description briefly displayed in preview after adding a receipt from a manual request[/+]on Sep 28, 2023
This code block is supposed to render the previewSubtitle label which can be the merchant if only one receipt requests exists or the number of requests count if more than one receipt requests exist.
The problem is the OR operator between these two variables previewSubtitle || moneyRequestComment, initially previewSubtitle is empty while the above-mentioned calculation is determined hence why the description shows up because moneyRequestComment is being shown while previewSubtitle is being determined.
This changes as soon as previewSubtitle is not empty anymore and is replaced by either the merchant if only one receipt requests exists or the number of requests count if more than one receipt requests exist.
What changes do you think we should make in order to solve the problem?
I would create another component below the existing one where we will always render the request description like so:
As you can see above, we show previewSubtitle or moneyRequestComment(description).
Looking at the previewSubtitle, we show merchant info if the IOU report has only one request and it has receipt, or we show the number of money requests.
But when the API returns, it has merchant value: Request.
This inconsistency causes the description displayed for a brief moment
What changes do you think we should make in order to solve the problem?
We need to make consistent the optimistic data and API returns.
Solution 1
We can set default merchant when building optimistic transaction here because we need to make the optimistic data consistent with API returns
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: N/A
Determine if we should create a regression test for this bug.
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.
Regression Test Proposal
Go to FAB > Request money > select Manual
Input any amount and click Next
Click on the three dots menu and select "Add receipt" and select a file
Enter a description and save
Tap "Request"
Verify that description is not shown and "Request" is shown in preview
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
[-]Request money - Description briefly displayed in preview after adding a receipt from a manual request[/-][+][$500] Request money - Description briefly displayed in preview after adding a receipt from a manual request[/+]melvin-bot commentedon Sep 28, 2023
Triggered auto assignment to @peterdbarkerUK (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Sep 28, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01a6766bd5a43af155
melvin-bot commentedon Sep 28, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Sep 28, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ntdiary (
External)ikevin127 commentedon Sep 28, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue
The description is briefly displayed in the preview when adding a receipt from a manual request.
What is the root cause of that problem?
The problem comes from the
ReportPreview.jscomponent:This code block is supposed to render the
previewSubtitlelabel which can be themerchantif only one receipt requests exists or the number of requests count if more than one receipt requests exist.The problem is the OR operator between these two variables
previewSubtitle || moneyRequestComment, initiallypreviewSubtitleis empty while the above-mentioned calculation is determined hence why the description shows up becausemoneyRequestCommentis being shown whilepreviewSubtitleis being determined.This changes as soon as
previewSubtitleis not empty anymore and is replaced by either themerchantif only one receipt requests exists or the number of requests count if more than one receipt requests exist.What changes do you think we should make in order to solve the problem?
I would create another component below the existing one where we will always render the request description like so:
{!isScanning && (numberOfRequests > 1 || hasReceipts) && ( <View style={styles.flexRow}> <View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}> <Text style={[styles.textLabelSupporting, styles.mb1, styles.lh20]}> {previewSubtitle} </Text> </View> </View> )} +{moneyRequestComment && ( + <View style={styles.flexRow}> + <View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}> + <Text style={[styles.textLabelSupporting, styles.mb1, styles.lh20]}> + {moneyRequestComment} + </Text> + </View> + </View> )}What alternative solutions did you explore? (Optional)
N/A
Videos
web.mp4
dummy-1111 commentedon Sep 28, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
When adding a receipt from a manual request, description is displayed for a brief moment
What is the root cause of that problem?
App/src/components/ReportActionItem/ReportPreview.js
Lines 216 to 222 in bfda42d
As you can see above, we show
previewSubtitleormoneyRequestComment(description).Looking at the
previewSubtitle, we show merchant info if the IOU report has only one request and it has receipt, or we show the number of money requests.App/src/components/ReportActionItem/ReportPreview.js
Lines 126 to 131 in bfda42d
The problem is in the value of
merchant. When we add a receipt, we setmerchantto emptyApp/src/pages/iou/ReceiptSelector/index.js
Line 120 in bfda42d
And when we create optimistic transaction, we also set merchant to empty
App/src/libs/TransactionUtils.js
Line 70 in bfda42d
But when the API returns, it has merchant value:

Request.This inconsistency causes the description displayed for a brief moment
What changes do you think we should make in order to solve the problem?
We need to make consistent the optimistic data and API returns.
Solution 1
We can set default merchant when building optimistic transaction here because we need to make the optimistic data consistent with API returns
App/src/libs/TransactionUtils.js
Line 70 in bfda42d
Solution 2
The backend should return empty merchant when receipt request with empty merchant is sent
Result
28380.mp4
What alternative solutions did you explore? (Optional)
melvin-bot commentedon Oct 3, 2023
@ntdiary, @peterdbarkerUK Eep! 4 days overdue now. Issues have feelings too...
61 remaining items
situchan commentedon Oct 31, 2023
Regression Test Proposal
situchan commentedon Oct 31, 2023
@peterdbarkerUK sorry for late. Can you also help with payment on #27710 please?
ayazhussain79 commentedon Oct 31, 2023
@peterdbarkerUK can you please check you have ended contract on upwork without paying
peterdbarkerUK commentedon Nov 2, 2023
Ah shoot, my mistake @ayazhussain79 - I'd had to add you to the job and didn't correctly pay it out when closing. I'm sorry.
I've sent you a new contract offer, bump me here once you've accepted it!
ayazhussain79 commentedon Nov 2, 2023
@peterdbarkerUK Np, Offer accepted and thank you
peterdbarkerUK commentedon Nov 2, 2023
Paid, thanks Ayaz!
peterdbarkerUK commentedon Nov 2, 2023
@situchan I've updated the original issue, thanks for raising it and I'm sorry for the error.
situchan commentedon Nov 2, 2023
No problem. Thanks
Also payment for this one (#28380) is pending
peterdbarkerUK commentedon Nov 2, 2023
Haha one at a time! I'm working through these but being interrupted by an ongoing interview ;-)
peterdbarkerUK commentedon Nov 2, 2023
Paid! Leaving open so I can sort out the regression testing tomorrow.
peterdbarkerUK commentedon Nov 6, 2023
QA Update proposal is up, thanks everyone for the fine work!