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.14k stars 2.63k forks source link

[$250] Chat - Error message reappears after sending another message #44824

Open izarutskaya opened 1 week ago

izarutskaya commented 1 week 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: v9.0.4-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: https://expensify.testrail.io/index.php?/tests/view/4693768 Email or phone of affected tester (no customers): vdargentotest+web070324@gmail.com Logs: https://stackoverflow.com/c/expensify/questions/4856 Issue reported by: Applause-Internal team

Action Performed:

  1. Go to any chat.
  2. Send a corrupted PDF file (there is one attached to this report).
  3. Verify an error message appears.
  4. Dismiss the error message by clicking on the "x" icon.
  5. Send another message.
  6. Verify the error message that was already dismissed reappears.

Expected Result:

The error message should not reappear.

Actual Result:

The error message reappears after sending another message.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

https://github.com/Expensify/App/assets/115492554/e2c8ced5-859b-43af-93d5-fb7991919527

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0167c1b57ade6a9fb4
  • Upwork Job ID: 1810456336736930787
  • Last Price Increase: 2024-07-15
Issue OwnerCurrent Issue Owner: @alitoshmatov
melvin-bot[bot] commented 1 week ago

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

izarutskaya commented 1 week ago

We think this issue might be related to the #vip-vsb

VictoriaExpensify commented 1 week ago

I haven't had a chance to look at this, will come back to it on Monday

nyomanjyotisa commented 1 week ago

Proposal

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

Error message reappears after sending another message

What is the root cause of that problem?

There is an error when uploading attachment: image

This happens because we directly assigning the file object (which contains non-clonable properties) to attachmentInfo which we use on optimisticData

This cause an error because we cannot store non-cloneable properties on IndexedDB

This make the reportActions_ onyx data not stored on IndexedDB

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

https://github.com/Expensify/App/blob/4ae133db275f32b59592e40a54ef6727c8f4891e/src/libs/ReportUtils.ts#L3702 Change this code to const attachmentInfo = file ? {...file} : {}; by this changes we create a shallow copy of the file object. This shallow copy contains only the properties of the file object, excluding any non-clonable properties

RESULT

https://github.com/user-attachments/assets/b1a47159-fd25-4039-a8c4-1b7415f0f614

What alternative solutions did you explore? (Optional)

melvin-bot[bot] commented 1 week ago

@VictoriaExpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] commented 1 week ago

Job added to Upwork: https://www.upwork.com/jobs/~0167c1b57ade6a9fb4

melvin-bot[bot] commented 1 week ago

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

VictoriaExpensify commented 1 week ago

I agree this is an issue and it should be fixed. Also agree that this is best suited to VSB

alitoshmatov commented 1 week ago

Thank you for your proposal @nyomanjyotisa . Can you expand on your RCA, why exactly having action data in failure data is causing this, I mean failure data is applied when request fails which is happening instantly when error is shown, then we are removing report action with error in https://github.com/expensify/app/blob/1f7c785753747a84b84c859cbdf4503447fc7bac/src/libs/actions/ReportActions.ts#L80

Moreover this piece of code was there for a long time and why now it is causing this?

amunim commented 3 days ago

Proposal

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

Error messages re-appear

What is the root cause of that problem?

queuedOnyxUpdates is not cleared if an error is thrown, this makes it stay in cache and apply again once we try to send a new message. https://github.com/Expensify/App/blob/fef8ef8c30e69b1807c9ec958e744dbc37816597/src/libs/actions/QueuedOnyxUpdates.ts#L16-L20

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

We add a catch clause like

    .catch(err => {
        console.error(err);
        queuedOnyxUpdates = [];
    });

or image

we check if the error is failed to execute 'put' on 'IDBObjectStore', then suppress the error, and splice only that, else throw again (a moderator with experience in the project can answer)

Result after changes: @alitoshmatov @VictoriaExpensify https://github.com/user-attachments/assets/975d864e-778a-42c9-be0d-80f03e7c7140

What alternative solutions did you explore? (Optional)

melvin-bot[bot] commented 3 days ago

📣 @amunim! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
amunim commented 3 days ago

Contributor details Your Expensify account email: abdulmunim2005@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~016f42c0501a199670

melvin-bot[bot] commented 3 days ago

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

nyomanjyotisa commented 2 days ago

Proposal updated @alitoshmatov

melvin-bot[bot] commented 1 day ago

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] commented 1 day ago

@VictoriaExpensify, @alitoshmatov Eep! 4 days overdue now. Issues have feelings too...

VictoriaExpensify commented 20 hours ago

@alitoshmatov - what are your thoughts on @nyomanjyotisa updated proposal?