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] Expense-Thread message for hold expense not shown in offline #49335

Open
3 of 6 tasks
IuliiaHerets opened this issue Sep 17, 2024 · 9 comments
Open
3 of 6 tasks
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 Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Sep 17, 2024

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:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6606357_1726561952395.az_recorder_20240917_135453_compress_1.mp4

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
Issue OwnerCurrent Issue Owner: @ntdiary
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 17, 2024
Copy link

melvin-bot bot commented Sep 17, 2024

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
Copy link
Author

@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
Copy link
Contributor

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

App/src/libs/actions/IOU.ts

Lines 7841 to 7844 in 00bc167

function putOnHold(transactionID: string, comment: string, reportID: string) {
const currentTime = DateUtils.getDBTime();
const createdReportAction = ReportUtils.buildOptimisticHoldReportAction(currentTime);
const createdReportActionComment = ReportUtils.buildOptimisticHoldReportActionComment(comment, DateUtils.addMillisecondsFromDateTime(currentTime, 1));

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 melvin-bot bot added the Overdue label Sep 19, 2024
Copy link

melvin-bot bot commented Sep 20, 2024

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

Copy link

melvin-bot bot commented Sep 24, 2024

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

@anmurali anmurali added the External Added to denote the issue can be worked on by a contributor label Sep 25, 2024
@melvin-bot melvin-bot bot changed the title Expense-Thread message for hold expense not shown in offline [$250] Expense-Thread message for hold expense not shown in offline Sep 25, 2024
Copy link

melvin-bot bot commented Sep 25, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 25, 2024
Copy link

melvin-bot bot commented Sep 25, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Sep 25, 2024
@ntdiary
Copy link
Contributor

ntdiary commented Sep 25, 2024

@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. 😂

// Update optimistic data for parent report action if the report is a child report
const optimisticParentReportData = ReportUtils.getOptimisticDataForParentReportAction(reportID, currentTime, CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);

@FitseTLT
Copy link
Contributor

@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. 😂

// Update optimistic data for parent report action if the report is a child report
const optimisticParentReportData = ReportUtils.getOptimisticDataForParentReportAction(reportID, currentTime, CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);

Agree 👍

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 Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
Status: No status
Development

No branches or pull requests

4 participants