Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.34k stars 2.77k forks source link

[$250] Distance - App crashes when deleting a distance expense when there are two distance expenses #46980

Open lanitochka17 opened 1 month ago

lanitochka17 commented 1 month ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: .0.17-1 Reproducible in staging?: Y Reproducible in production?: Y 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): sarahhailu1268+dhsdfsdhgshg@gmail.com Issue reported by: Applause - Internal Team

Action Performed:

  1. Log in to the staging app with a new account
  2. Create a new workspace
  3. Go to FAB > Submit Expense > Distance
  4. Enter start and finish waypoints > Submit it to the workspace
  5. Again go to FAB > Submit Expense > Distance
  6. Enter start and finish waypoints > Submit it to the workspace
  7. After the expenses are created go into the combined report and click on the first expense
  8. Click on the header > Delete expense > Confirm

Expected Result:

The app will not crash and the expense is successfully deleted

Actual Result:

App crashes

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/57f7d4e0-f012-4cb0-9cae-b8bd42181cce

logs (2).txt

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0183948967c6155377
  • Upwork Job ID: 1821209382283102288
  • Last Price Increase: 2024-08-14
  • Automatic offers:
    • dominictb | Contributor | 103641053
Issue OwnerCurrent Issue Owner: @dominictb
melvin-bot[bot] commented 1 month ago

Triggered auto assignment to @greg-schroeder (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.

lanitochka17 commented 1 month ago

@greg-schroeder FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

lanitochka17 commented 1 month ago

We think that this bug might be related to #wave-collect - Release 1

melvin-bot[bot] commented 1 month ago

Job added to Upwork: https://www.upwork.com/jobs/~0183948967c6155377

melvin-bot[bot] commented 1 month ago

Triggered auto assignment to Contributor-plus team member for initial proposal review - @mollfpr (External)

etCoderDysto commented 1 month ago

Edited by proposal-police: This proposal was edited at 2024-08-07 15:46:57 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

App crashes when deleting a distance expense when there are two distance expenses

What is the root cause of that problem?

When deleting a distance request tags become undefined here https://github.com/Expensify/App/blob/0a33186c80eb821d67d75b44bca527640204852c/src/libs/OptionsListUtils.ts#L1355-L1356

What changes do you think we should make in order to solve the problem?

We should use nullish coalescing operator to return empty array when tags is undefined in Ojbect.values

const policyTagValueList = policyTagList.map(({tags}) => Object.values(tags ?? [])).flat();

What alternative solutions did you explore? (Optional)

Result:

https://github.com/user-attachments/assets/c84c2d01-fb82-4c0f-8bcd-20476a216ad6

etCoderDysto commented 1 month ago

Updated Proposal

Amoralchik commented 1 month ago

What is the root cause of that problem?

The data we are working with in hasEnabledTags might be an array of objects, with the first key being Tag.

image

Because of this, destructuring {tags} in policyTagList returns undefined. https://github.com/Expensify/App/blob/0a33186c80eb821d67d75b44bca527640204852c/src/libs/OptionsListUtils.ts#L1356

In most cases, this doesn't cause problems because in:

https://github.com/Expensify/App/blob/195691e2c231e559e21470fc5fa547bc0f3e51bc/src/components/ReportActionItem/MoneyRequestView.tsx#L201

we rely on isPolicyExpenseChat or transactionTag. However, when neither is present, it falls back to hasEnabledTags.

So why? I don't know, unfortunately, after clearing the cache I can no longer reproduce this bug. This fix might work, but I want to understand why the user might receive a list like the one in the screenshot. I'll keep investigating, as I think the problem might be much larger. Anyway, if I find anything, I'll let you know.

dominictb commented 1 month ago

Edited by proposal-police: This proposal was edited at 2024-08-08 10:22:42 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

The app crashes.

What is the root cause of that problem?

What changes do you think we should make in order to solve the problem?

What alternative solutions did you explore? (Optional)

dominictb commented 1 month ago

Proposal updated

melvin-bot[bot] commented 1 month ago

@mollfpr, @greg-schroeder Eep! 4 days overdue now. Issues have feelings too...

trjExpensify commented 1 month ago

@mollfpr can you review this proposal, please?

greg-schroeder commented 1 month ago

Yes, awaiting proposal review

mollfpr commented 1 month ago

Reviewing πŸ‘€

mollfpr commented 1 month ago

@etCoderDysto @dominictb Do you guys still able to reproduce the issue?

etCoderDysto commented 1 month ago

@mollfpr I am not able to reproduce this.

dominictb commented 1 month ago

@mollfpr Actually, with the OP's reproduce steps, I cannot reproduce. But based on my RCA, I still can reproduce the bug if there is report_undefined key in onyx.

dominictb commented 1 month ago

To create a report_undefined key in onyx, we can just go to this url https://dev.new.expensify.com:8082/r/undefined

melvin-bot[bot] commented 1 month ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

mollfpr commented 1 month ago

@dominictb I didn't get the crash on staging with the above suggestion.

dominictb commented 1 month ago

@mollfpr Here is the video from my side:

https://github.com/user-attachments/assets/8330c078-a65b-441d-9938-61dbf15c6677

mollfpr commented 1 month ago

@dominictb I can reproduce the issue now and it seems your RCA is correct.

We can go with @dominictb proposal's but using both main and alternative solution.

πŸŽ€ πŸ‘€ πŸŽ€ C+ reviewed!

melvin-bot[bot] commented 1 month ago

Triggered auto assignment to @aldo-expensify, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] commented 1 month ago

@mollfpr @greg-schroeder @aldo-expensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

dominictb commented 1 month ago

@aldo-expensify Can you help review my proposal above?

melvin-bot[bot] commented 1 month ago

πŸ“£ @dominictb πŸŽ‰ An offer has been automatically sent to your Upwork account for the Contributor role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Keep in mind: Code of Conduct | Contributing πŸ“–

dominictb commented 4 weeks ago

Just want to note the reproduce steps for this bug:

  1. Paste this url to any chat https://dev.new.expensify.com:8082/r/undefined.
  2. Click on the above url message.
  3. Submit 2 expenses to any workspace.
  4. Click on the report preview in step 3.
  5. Delete the first message.
  6. Verify app is crashed.
greg-schroeder commented 3 weeks ago

PR is in review, next up is @mollfpr!

greg-schroeder commented 1 week ago

PR still going through review

greg-schroeder commented 5 days ago

Bump @aldo-expensify I believe you're up for a re-review here?

aldo-expensify commented 5 days ago

Thank you, I had missed the notification before. PR merged.

melvin-bot[bot] commented 3 days ago

This issue has not been updated in over 15 days. @mollfpr, @greg-schroeder, @aldo-expensify, @dominictb eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

trjExpensify commented 3 days ago

PR hit staging yesterday, Melv.

greg-schroeder commented 3 days ago

Just awaiting deploy to prod!