App icon indicating copy to clipboard operation
App copied to clipboard

[$500] Android - IOU-Error message remains on IOU report even same error message is dismissed from 1:1

Open lanitochka17 opened this issue 1 year ago • 37 comments

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.23-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Applause - Internal Team Slack conversation:

Action Performed:

  1. Log in with separate accounts in the main testing device and a secondary device
  2. In the main testing device create an IOU with a user
  3. Disable the internet connection in the main testing device
  4. In the main testing device (while offline) cancel the IOU
  5. In the secondary device (online) mark the IOU as paid with the option "Settled up elsewhere"
  6. Enable the internet connection in the main testing device
  7. Verify a red dot appears on the chat in LHN
  8. Tap the X from the conversation
  9. Go to IOU report

Expected Result:

Since User dismiss the X error should not appear into IOU report

Actual Result:

Error message remains on IOU report even same error message is dismissed from 1:1

Workaround:

Unknown

Platforms:

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

  • [x] Android: Native
  • [ ] Android: mWeb Chrome
  • [ ] iOS: Native
  • [ ] iOS: mWeb Safari
  • [ ] MacOS: Chrome / Safari
  • [ ] MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/78819774/36572323-44bc-4adb-bf1f-35470abbdf78

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019c035b355c60f48e
  • Upwork Job ID: 1754884327412707328
  • Last Price Increase: 2024-02-06

lanitochka17 avatar Jan 09 '24 21:01 lanitochka17

Job added to Upwork: https://www.upwork.com/jobs/~015c3e14be277849ac

melvin-bot[bot] avatar Jan 09 '24 21:01 melvin-bot[bot]

Triggered auto assignment to @alexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

melvin-bot[bot] avatar Jan 09 '24 21:01 melvin-bot[bot]

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

melvin-bot[bot] avatar Jan 09 '24 21:01 melvin-bot[bot]

Proposal

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

Error message remains on IOU report even same error message is dismissed from 1:1

What is the root cause of that problem?

When we failed to delete the money request, there'll be 2 different errors created on the IOU report and the chat report here and here

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

When we generate the errors on IOU report and chat report, generate them with the same microseconds since they are basically 1 single error.

When clearing the error from either the IOU report or the chat report, optionally check if the error content is iou.error.genericDeleteFailureMessage, if true, we'll find a report action from the other report (if IOU report then we find in chat report and vice versa) that has an error with the same microseconds (and error content), and clear that error as well.

Detail implementation

  1. Define the errorKey
    const errorKey = DateUtils.getMicroseconds();
  1. Store the error for the action itself Update this line here to
errors: {
                        [errorKey]: 'iou.error.genericDeleteFailureMessage'
                    }

and here to

errors: {
                        [errorKey]: 'iou.error.genericDeleteFailureMessage'
                    },
  1. Create new function named clearAllRelatedReportActionErrors in libs/action/ReportActions.ts to clear the error from action itself and children/parent actions

  2. Update onClose to use clearAllRelatedReportActionErrors

onClose={() => ReportActions.clearAllRelatedReportActionErrors(props.report.reportID, props.action)}

Here's the test branch: https://github.com/tienifr/App/tree/fix/34189

What alternative solutions did you explore? (Optional)

The same approach listed above can be applied to many other scenarios where there's an error that occurs in multiple places but actually are the same error.

Another approach is to make microsecond errors an error object instead of just a text/translation key. In that object we can include metadata on where else this same error is added and use that to clear the error. Or we can even create a dedicated errors_${microseconds} key in Onyx to store the metadata, and when deleting we cross check that object to see if there's anywhere else this error needs to be deleted.

Result

https://github.com/Expensify/App/assets/113963320/3ae0d590-a6a4-475e-bca7-44f0422132bf

tienifr avatar Jan 10 '24 01:01 tienifr

Agree with @tienifr's diagnosis. 👍

Not sure about adding logic to sync error deletion across reports though, adds a fair bit of complexity and potential for more bugs.

Ideally, if we want the error to behave as it belongs to a single entity (say IOU report) and displayed in multiple places, we should reflect that in the data and component structure. Data normalisation, as opposed to duplication. Otherwise, we may find this type of issue props up again.

Thoughts?

codebycarlos avatar Jan 10 '24 12:01 codebycarlos

I agree with @tienifr and @codebycarlos. I checked his proposal. The proposal advises that the data structure be normalized. This would eliminate duplicate errors and speed up the resolution process. The solution aims for simplicity and effectiveness by providing consistent error generation with shared microseconds and updating dismissal logic to eliminate errors from both reports at the same time.

kaushiktd avatar Jan 11 '24 08:01 kaushiktd

@alexpensify, @Santhosh-Sellavel Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Jan 15 '24 17:01 melvin-bot[bot]

@Santhosh-Sellavel - could you please share feedback here on the proposals and other comments? Thanks!

alexpensify avatar Jan 15 '24 18:01 alexpensify

@Santhosh-Sellavel - please keep me posted if you are unable to review this one. Thanks!

alexpensify avatar Jan 17 '24 18:01 alexpensify

When we generate the errors on the IOU report and chat report, generate them with the same microseconds since they are basically 1 single error.

@tienifr How you are planning to do that, can you elaborate on that?

Santhosh-Sellavel avatar Jan 17 '24 19:01 Santhosh-Sellavel

Waiting for @tienifr feedback here.

alexpensify avatar Jan 19 '24 19:01 alexpensify

Added the detail implementation cc @Santhosh-Sellavel @alexpensify

tienifr avatar Jan 22 '24 11:01 tienifr

@tienifr Always better to add a follow-up instead of always editing the first comment

Santhosh-Sellavel avatar Jan 22 '24 16:01 Santhosh-Sellavel

@Santhosh-Sellavel - do we need more proposals here or wait for an updated proposal from @tienifr? Thanks for clarifying where we are at for this issue. Thanks!

alexpensify avatar Jan 24 '24 17:01 alexpensify

Sorry, I forgot to post a review comment. Yeah, let's wait for other proposals.

Santhosh-Sellavel avatar Jan 24 '24 18:01 Santhosh-Sellavel

Sounds like a plan!

Open for proposals here

alexpensify avatar Jan 26 '24 18:01 alexpensify

I'm unavailable next week, Please assign a new C+ Issue here if required while I am away, thanks!

cc: @alexpensify

Santhosh-Sellavel avatar Jan 27 '24 17:01 Santhosh-Sellavel

I can take over as C+ contributor

DylanDylann avatar Jan 29 '24 15:01 DylanDylann

@Santhosh-Sellavel I already updated my proposal as I mentioned here. Wdyt?

tienifr avatar Jan 29 '24 15:01 tienifr

Alright, @DylanDylann you are the new C+ here. Please keep us posted if one of these proposals will fix this issue. Thanks!

alexpensify avatar Jan 29 '24 20:01 alexpensify

Also, @Santhosh-Sellavel - thank you for giving me this notice! We will keep moving forward here.

alexpensify avatar Jan 29 '24 20:01 alexpensify

@tienifr Why does this bug only happen on android?

DylanDylann avatar Jan 30 '24 07:01 DylanDylann

@tienifr Small note

The same approach listed above can be applied to many other scenarios where there's an error that occurs in multiple places but actually are the same error.

This point should be a bonus point in the section What changes do you think we should make in order to solve the problem?

It is not a alternative solution

DylanDylann avatar Jan 30 '24 07:01 DylanDylann

Why does this bug only happen on android?

This bug happens on all platforms.

tienifr avatar Jan 30 '24 07:01 tienifr

@tienifr I can't reproduce on web. Correct me if I miss any step

https://github.com/Expensify/App/assets/141406735/172f3748-8bce-43d9-b58a-485949d40d31

DylanDylann avatar Jan 30 '24 08:01 DylanDylann

@DylanDylann Can you reproduce on android?

tienifr avatar Jan 30 '24 08:01 tienifr

@alexpensify @DylanDylann this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!

melvin-bot[bot] avatar Jan 30 '24 15:01 melvin-bot[bot]

Can't reproduce anymore

DylanDylann avatar Feb 01 '24 09:02 DylanDylann

@tienifr can you reproduce or do you agree with @DylanDylann? If yes, we will close. Thanks!

alexpensify avatar Feb 02 '24 22:02 alexpensify

I still can reproduce. @alexpensify @DylanDylann

https://github.com/Expensify/App/assets/113963320/71a3f67d-03fc-4954-a659-2c9964430117

tienifr avatar Feb 05 '24 03:02 tienifr