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.36k stars 2.78k forks source link

[$250] Expense-Thread message for hold expense not shown in offline #49335

Open IuliiaHerets opened 1 week ago

IuliiaHerets 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: 9.0.36-1 Reproducible in staging?: Y Reproducible in production?: Y Issue reported by: Applause Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Go offline
  3. Open 1:1 DM
  4. Create a expense
  5. Long press the expense and then hold & unhold the expense
  6. Note reply thread not displayed
  7. Open the expense
  8. Note hold expense system message displayed
  9. Go online
  10. Go to conversation page
  11. After going online, thread reply message shown

Expected Result:

Thread message for hold expense must be shown in offline.

Actual Result:

Thread message for hold expense not shown in offline.

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/7b32e081-9998-4c75-95cd-c2c29db3af96

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021838745172566353951
  • Upwork Job ID: 1838745172566353951
  • Last Price Increase: 2024-09-25
  • Automatic offers:
    • FitseTLT | Contributor | 104144996
Issue OwnerCurrent Issue Owner: @ntdiary
melvin-bot[bot] commented 1 week ago

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.

IuliiaHerets commented 1 week ago

@anmurali 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

FitseTLT commented 1 week ago

Proposal

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

Expense-Thread message for hold expense not shown in offline

What is the root cause of that problem?

In putOnHold here https://github.com/Expensify/App/blob/00bc167940607f1418109f00e2b4e2d7d4ae858b/src/libs/actions/IOU.ts#L7841-L7844 we are only creating the report actions optimistically but not updating the parentReportAction with the necessary data such as childVisibleActionCount ... Same problem exists in Unhold too.

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

In putOnHold we should optimistically update parentReportAction. We can use ReportUtils.getOptimisticDataForParentReportAction to get optimistic data with the necessary props for the parent action and set it to the optimistic data

    const parentReportActionOptimistic = ReportUtils.getOptimisticDataForParentReportAction(reportID, createdReportActionComment.created, CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);

we can also revert the changes on failureData. Same should also be done unHoldRequest

    const parentReportActionOptimistic = ReportUtils.getOptimisticDataForParentReportAction(reportID, createdReportActionComment.created, CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);

One related problem I saw here is we are not updating the lastVisibleActionCreated of the report so the app doesn't auto- scroll to the newly created hold report actions so we can set lastVisibleActionCreated of the report optimistically for both hold (createdReportActionComment.created) and unhold (createdReportActionComment.created) cases.

What alternative solutions did you explore? (Optional)

melvin-bot[bot] commented 1 week ago

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

melvin-bot[bot] commented 5 days ago

@anmurali Still overdue 6 days?! Let's take care of this!

melvin-bot[bot] commented 4 days ago

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

melvin-bot[bot] commented 4 days ago

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

ntdiary commented 4 days ago

@FitseTLT, I generally agree with your proposal. I think the hold action is similar to sending a message, and we should try to update the parent report if it exists. However, interestingly, I'm not very sure if we should revert it back in the failureData, since I didn’t see this reversion in the send message function either. πŸ˜‚ https://github.com/Expensify/App/blob/48e9c176b3111870ebe5e6193312334e32c249ea/src/libs/actions/Report.ts#L605-L606

FitseTLT commented 4 days ago

@FitseTLT, I generally agree with your proposal. I think the hold action is similar to sending a message, and we should try to update the parent report if it exists. However, interestingly, I'm not very sure if we should revert it back in the failureData, since I didn’t see this reversion in the send message function either. πŸ˜‚

https://github.com/Expensify/App/blob/48e9c176b3111870ebe5e6193312334e32c249ea/src/libs/actions/Report.ts#L605-L606

Agree πŸ‘

ntdiary commented 4 days ago

OK, I think it' fine to move forward with your proposal. :)

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

melvin-bot[bot] commented 4 days ago

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

melvin-bot[bot] commented 3 days ago

πŸ“£ @FitseTLT πŸŽ‰ 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 πŸ“–