App
App copied to clipboard
[$250] IOU - Copied link URL includes "Undefined"
If you havenโt already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 1.4.66-2 Reproducible in staging?: Y Reproducible in production?: Y Logs: https://stackoverflow.com/c/expensify/questions/4856 Issue reported by: Applause-Internal team
Action Performed:
- Navigate to staging.new.expensify.com
- Send an IOU to a user
- Open the expense report and send a comment
- Reply in thread to the sent comment on step 3
- Hover over the IOU preview component and click on copy link
- Paste the copied link elsewhere
Expected Result:
The copied URL doesn't include "Undefined"
Actual Result:
The copied URL includes "Undefined" at the end
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [ ] Android: Native
- [ ] Android: mWeb Chrome
- [ ] iOS: Native
- [ ] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
https://github.com/Expensify/App/assets/115492554/3fa41282-c99f-4aa4-aa93-6d2dd347ad6a
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~01a65eb92968b7e037
- Upwork Job ID: 1784516119574372352
- Last Price Increase: 2024-04-28
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.
We think this issue might be related to the #vip-vsb.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Copied link URL includes "Undefined"
What is the root cause of that problem?
on context menu, the copy link menu item const reportActionID = reportAction?.reportActionID; can be undefined
https://github.com/Expensify/App/blob/035adb890e559f287368b75f8cbe138c20e3f73a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx#L398-L403
What changes do you think we should make in order to solve the problem?
We need to check if the value reportAction?.reportActionID
is available first.
const reportActionID = reportAction?.reportActionID || '';
POC:
https://github.com/Expensify/App/assets/12425932/36d54266-a6f7-417a-b97a-9c51d7d3f542
Proposal
Please re-state the problem that we are trying to solve in this issue.
reportActionID
in URL is undefined
when reply an expense report's message in thread
What is the root cause of that problem?
originalReportID
evaluated in ReportActionItem
points to the transaction thread report, but should be the policy expense report instead:
https://github.com/Expensify/App/blob/2d887588583e87e3f1cb9e29352f2399b9813ff6/src/libs/ReportUtils.ts#L5277-L5279
By the early return above, we skip the isThreadFirstCheck
which should be used for the report preview action in this case.
Then when we retrieved the report actions in BaseReportActionContextMenu
we couldn't find the correct action because it apparently belonged to another report:
https://github.com/Expensify/App/blob/d3eeff38c7d8bf1d576b7f3faca6aac06fbd6c06/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx#L304
https://github.com/Expensify/App/blob/2d887588583e87e3f1cb9e29352f2399b9813ff6/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx#L134
What changes do you think we should make in order to solve the problem?
We should prioritize the isThreadFirstChat
check:
https://github.com/Expensify/App/blob/2d887588583e87e3f1cb9e29352f2399b9813ff6/src/libs/ReportUtils.ts#L5277-L5282
if (Object.keys(currentReportAction ?? {}).length === 0) {
return isThreadFirstChat(reportAction, reportID) ? parentReportID : transactionThreadReportID ?? reportID;
}
return reportID;
What alternative solutions did you explore? (Optional)
Or we can just show [Deleted report]
in this case, by this user couldn't copy link. That means expense reports with no expenses are deleted. To do this, we can either:
- Modify the
isClosedExpenseReportWithNoExpenses
to not include thestatusNum
condition. Now it should beisExpenseReportWithNoExpenses
:
https://github.com/Expensify/App/blob/fa29a354df9be559c2e5008523562c7384fb2aeb/src/libs/ReportUtils.ts#L1146
- Modify the backend to set the expense report's
statusNum
toCLOSED
(i.e.2
) when there're no expenses.
Job added to Upwork: https://www.upwork.com/jobs/~01a65eb92968b7e037
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil (External
)
This feels like low priority / polish for vip-vsb
@rojiphil, @laurenreidexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Hi @rojiphil did you have a chance to take a look?
@rojiphil bump for review ^^
@gijoe0295 As per your proposal, the copied link will have reportActionID
as that of the Report Preview action and reportID
as that of the Report Preview actionโs Chat Report. Is my understanding correct?
And sorry for the delay in review here.
@rojiphil Yes, correct. In other words, that will link to the report preview action in the policy expense report (not the expense report currently).
Yes, correct. In other words, that will link to the report preview action in the policy expense report (not the expense report currently).
@gijoe0295 And why do you think reportID
should point to the policy expense report?
@rojiphil because the report preview is in the policy expense report. If it didn't point to the correct report, it would cause errors like this one, or navigate to not found page.
@gijoe0295 Thanks for the clarifications.
@gijoe0295 proposal has the correct RCA and solution.
This will also ensure Copy to clipboard
to work correctly which is otherwise broken currently.
๐๐๐ C+ reviewed
Triggered auto assignment to @bondydaa, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
๐ฃ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? ๐ธ
@bondydaa this one is ready for review ๐
โ There was an error making the offer to @rojiphil for the Reviewer role. The BZ member will need to manually hire the contributor.
โ There was an error making the offer to @gijoe0295 for the Contributor role. The BZ member will need to manually hire the contributor.
oh GH issues might have caused that https://www.githubstatus.com/incidents/tsrh60nkbchl
@gijoe0295 looks like we good to go - please let us know when you expect to have a draft PR up thanks
Payment Summary:
- C+ @rojiphil $250 offer sent in upwork
- Contributor @gijoe0295 $250 offer sent in upwork
- C+ @rojiphil $250 offer sent in upwork
Thanks @laurenreidexpensify. Accepted the offer
Payment Summary:
C+ @rojiphil $250 paid in upwork Contributor @gijoe0295 $250 paid in upwork
@rojiphil do we need a regression test for this - please confirm steps if so, thanks
do we need a regression test for this - please confirm steps if so, thanks
A regression test is not required as this issue occurs only in certain cases and is not high-impact. We can skip this.