Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[$250] Chat - The main IOU disappears from chat report even if there are threaded replies #56650

Open
8 tasks done
IuliiaHerets opened this issue Feb 11, 2025 · 29 comments
Open
8 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Feb 11, 2025

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: 9.0.96-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
Issue reported by: Applause Internal Team
App Component: Money Requests

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Create an expense with an account
  3. Go inside the expense report and send a comment
  4. Reply in thread of the sent comment
  5. Delete the IOU
  6. Create another Manual Expense
  7. Go back through the header subtitle
  8. Navigate into the expense report by clicking on the report preview
  9. Go back to the main chat by clicking on the header subtitle

Expected Result:

A deleted message appears since there are threaded replies and the amount on the header of the expense report on step 8 will show the correct amount not 0.0

Actual Result:

The IOU disappears from the main chat and no Deleted message comment appears. The amount on step 8 shows the correct one instead of 0.0

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

https://github.com/user-attachments/assets/64933a1f-ec9b-4507-890c-93af1519239d
https://github.com/user-attachments/assets/de409ac5-7c51-4e96-b8d9-1167dbc6af0a

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021895202979936011985
  • Upwork Job ID: 1895202979936011985
  • Last Price Increase: 2025-02-27
Issue OwnerCurrent Issue Owner: @OlimpiaZurek
@IuliiaHerets IuliiaHerets added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Feb 11, 2025
Copy link

melvin-bot bot commented Feb 11, 2025

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

@melvin-bot melvin-bot bot added the Overdue label Feb 13, 2025
Copy link

melvin-bot bot commented Feb 14, 2025

@anmurali Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Copy link

melvin-bot bot commented Feb 18, 2025

@anmurali 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

Copy link

melvin-bot bot commented Feb 20, 2025

@anmurali Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!

Copy link

melvin-bot bot commented Feb 24, 2025

@anmurali 12 days overdue now... This issue's end is nigh!

Copy link

melvin-bot bot commented Feb 25, 2025

@anmurali this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@anmurali anmurali removed the Bug Something is broken. Auto assigns a BugZero manager. label Feb 25, 2025
@anmurali anmurali removed their assignment Feb 25, 2025
@melvin-bot melvin-bot bot removed the Overdue label Feb 25, 2025
@anmurali anmurali added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 and removed Daily KSv2 labels Feb 25, 2025
Copy link

melvin-bot bot commented Feb 25, 2025

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

@joekaufmanexpensify
Copy link
Contributor

I will triage tomorrow!

@joekaufmanexpensify
Copy link
Contributor

Interesting. I can reproduce this both with IOUs and expense reports. @rlinoz @Krishna2323 @shubham1206agra I feel like this could be related to #54804 given the timing, what do you think?

2025-02-27_15-01-18.mp4

@joekaufmanexpensify joekaufmanexpensify added the External Added to denote the issue can be worked on by a contributor label Feb 27, 2025
@melvin-bot melvin-bot bot changed the title Chat - The main IOU disappears from chat report even if there are threaded replies [$250] Chat - The main IOU disappears from chat report even if there are threaded replies Feb 27, 2025
Copy link

melvin-bot bot commented Feb 27, 2025

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 27, 2025
Copy link

melvin-bot bot commented Feb 27, 2025

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

@rlinoz
Copy link
Contributor

rlinoz commented Feb 27, 2025

Maybe, but this one seems more likely I think #53549

@rlinoz
Copy link
Contributor

rlinoz commented Feb 27, 2025

Ok, looking at the report the reportAction is there, it is just not showing, so not the issue I linked.

Image

@joekaufmanexpensify
Copy link
Contributor

@rlinoz Got it. Do you think it could still be the one I lined, or not either?

@rlinoz
Copy link
Contributor

rlinoz commented Feb 28, 2025

Ah yeah, I forgot to comment on that one, sorry!

I tested using this build here #54804 (comment) and the problem didn't show up, so I think it is not that one either

@OlimpiaZurek
Copy link
Contributor

Hey! I'm Olimpia from Callstack - expert contributor group - and I'd like to work on this issue.

@melvin-bot melvin-bot bot added the Overdue label Mar 3, 2025
@melvin-bot melvin-bot bot removed Help Wanted Apply this label when an issue is open to proposals by contributors Overdue labels Mar 3, 2025
@dylanexpensify dylanexpensify moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Mar 4, 2025
@OlimpiaZurek
Copy link
Contributor

I've started looking into this issue and was able to reproduce it, but only in specific cases.

It happens when there's a single submitted expense with reply messages. After deleting this expense, the API returns false for isDeletedParentAction, which prevents the "Deleted message" comment from appearing. Then, when trying to submit another expense for the same report, the API returns:

message: "400 Unique Constraints Violation"

This may be a backend issue. I'll continue looking into it further.

Copy link

melvin-bot bot commented Mar 7, 2025

@Pujan92 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Mar 7, 2025
@joekaufmanexpensify
Copy link
Contributor

@OlimpiaZurek Any further update on this one?

@OlimpiaZurek
Copy link
Contributor

Posting an update with my findings so far:

  • This PR only handles cases where there are two expenses, and in that scenario, it works as expected. However, there are no cases addressing a single expense.
  • I noticed that when I delete an expense and return to the main chat, the expense initially disappears but reappears after some time.
  • Since there is no IOU report anymore, only ReportPreview exists, which then displays the preview as shown below:
Image
  • In offline mode, the preview appears immediately after returning to the main chat, indicating that Onyx data updates properly. The disappearing preview seems to be an API issue— it appears to take some time for the backend to update the data.
  • when trying to submit another expense during the time between the expense disappearing and reappearing, the API returns a 400 Unique Constraints Violation error.

Given this, I have some questions:

  • In which cases does the API for the RequestMoney command return a 400 Unique Constraints Violation error?
  • What is the expected behavior when there is only one expense? After deleting this expense with a thread, should the main chat display a Deleted Expense ?
  • If so, this will require some adjustments, considering this is a ReportPreview and not an IOU:
    } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW) {

@melvin-bot melvin-bot bot removed the Overdue label Mar 7, 2025
@rlinoz
Copy link
Contributor

rlinoz commented Mar 7, 2025

In which cases does the API for the RequestMoney command return a 400 Unique Constraints Violation error?

When we try to create a money request using an already existing transactionID, do you see the same transactionID being sent in different RequestMoney calls?

@OlimpiaZurek
Copy link
Contributor

No, the transactionID differs for each RequestMoney call. Here are some example payloads:

First MoneyRequest call:

Image

Second MoneyRequest call:

Image

@rlinoz
Copy link
Contributor

rlinoz commented Mar 7, 2025

Oh it is actually thorwing trying to create the report preview action again apparently, super weird.

Copy link

melvin-bot bot commented Mar 11, 2025

@Pujan92 @OlimpiaZurek @joekaufmanexpensify this issue is now 4 weeks old, please consider:

  • Finding a contributor to fix the bug
  • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

@melvin-bot melvin-bot bot added the Overdue label Mar 11, 2025
Copy link

melvin-bot bot commented Mar 11, 2025

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

@OlimpiaZurek
Copy link
Contributor

I've found the root cause of this issue and working on a proposal.

@melvin-bot melvin-bot bot removed the Overdue label Mar 11, 2025
@joekaufmanexpensify
Copy link
Contributor

Wooo, thanks!

@OlimpiaZurek
Copy link
Contributor

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

After deleting the IOU, it disappears from the main chat and no Deleted message comment appears.

What is the root cause of that problem?

Currently, the [Deleted expense] is displayed for IOU's based on the message.isDeletedParentAction flag. When an expense is deleted, this flag is correctly set on the IOU reportAction, ensuring that the deleted message comment appears. However, this logic only works when there are multiple reportActions with at least one IOU reportAction.

When there is only one expense, deleting it removes the IOU reportAction (actionName: IOU), leaving only the ReportPreview reportAction. In this case:

  • The message.deleted field is set with the deletion timestamp.
  • According to the current logic, reportActions marked as deleted are not shown in the reportActionList.
  • As a result, the [Deleted message] does not appear in the chat.

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

To ensure the [Deleted message] appears, we need to adjust the logic:

Frontend Changes:

  1. Set isDeletedParentAction on previewReportAction when deleting an expense.
  2. Update the logic in PureReportActionItem to allow displaying the [Deleted message] under this condition.

Backend Fixes Required:

  1. The API currently returns isDeletedParentAction: false, even though Onyx stores it as true in optimistic data. This inconsistency needs to be resolved.
  2. When deleting a single or last expense, the API sets message.deleted to the deletion timestamp, preventing the ReportPreview action from appearing in the chat. To fix this, message.deleted should be set to null instead of a timestamp when the last expense is deleted.
  3. After deleting the last expense, creating a new one sometimes triggers a 400 Unique Constraints Violation error, even when transactionID is different. This must be investigated and fixed.

Once the necessary backend fixes are in place, the frontend logic can be updated accordingly to fully resolve these issue.

@joekaufmanexpensify
Copy link
Contributor

@Pujan92 thoughts on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
Status: Bugs and Follow Up Issues
Development

No branches or pull requests

6 participants