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

[Hold for payment 2024-05-30][$250] Deleted message disappear for a moment when transistioning from offline to online #39218

Closed
1 of 6 tasks
kavimuru opened this issue Mar 28, 2024 · 34 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Mar 28, 2024

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.57-3
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: @roryabraham
Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1711665611722399?thread_ts=1711571474.268739&cid=C01GTK53T8Q

Action Performed:

  1. Go offline
  2. Send a message
  3. Reply to the message
  4. Delete the message you sent in (2)
  5. Come back online

Expected Result:

While waiting for the network request to process deleted message should appear strikethrough and then deleted message should appear

Actual Result:

While network request from offline to online processes, the message deleted from step 2 will disappear rather than showing [Deleted Message].

Workaround:

unknown

Platforms:

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

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

Screenshots/Videos

Add any screenshot/video evidence

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017b4b082efdd47324
  • Upwork Job ID: 1795973516571975680
  • Last Price Increase: 2024-05-30
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 28, 2024
Copy link

melvin-bot bot commented Mar 28, 2024

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

@kavimuru kavimuru added the DeployBlockerCash This issue or pull request should block deployment label Mar 28, 2024
Copy link

melvin-bot bot commented Mar 28, 2024

Current assignee @roryabraham is eligible for the DeployBlockerCash assigner, not assigning anyone new.

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Mar 28, 2024
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@allgandalf
Copy link
Contributor

The issue mentions reproducible in both so NAB right ? @roryabraham @kavimuru

@shubham1206agra
Copy link
Contributor

@roryabraham Please assign me as C+ here as I was C+ on the previous issue too.

@yuwenmemon yuwenmemon removed the DeployBlockerCash This issue or pull request should block deployment label Mar 29, 2024
@yuwenmemon
Copy link
Contributor

Yeah if this is reproducible in both this is not a blocker.

@sonialiap
Copy link
Contributor

Since this is not a blocker, moving to Daily

@sonialiap sonialiap added Daily KSv2 and removed Hourly KSv2 labels Mar 29, 2024
@melvin-bot melvin-bot bot added the Overdue label Apr 1, 2024
@FitseTLT
Copy link
Contributor

FitseTLT commented Apr 1, 2024

Proposal

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

Deleted message disappear for a moment when transistioning from offline to online

What is the root cause of that problem?

In here

App/src/libs/actions/Report.ts

Lines 1315 to 1316 in 99cc0b6

isDeletedParentAction
? [WRITE_COMMANDS.UPDATE_COMMENT]

We haven't included ADD_COMMENT when the report action is isThreadParentMessage so as we created the report action offline (ADD_COMMENT) the isDeletedReportAction set as true by DELETE_COMMENT of the parent message is getting reset when going online and the isDeletedReportAction is being reset to false and as the message.html is empty it will disappear and get not displayed

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

We need to add ADD_COMMENT for parent messages too here as they are conflicting requests

App/src/libs/actions/Report.ts

Lines 1315 to 1316 in 99cc0b6

isDeletedParentAction
? [WRITE_COMMANDS.UPDATE_COMMENT]

isDeletedParentAction
                        ? [WRITE_COMMANDS.ADD_COMMENT, WRITE_COMMANDS.UPDATE_COMMENT]

What alternative solutions did you explore? (Optional)

@sonialiap
Copy link
Contributor

@shubham1206agra what do you think of the above proposal?

@roryabraham
Copy link
Contributor

putting this on HOLD for #39432, as there's a good likelihood this will be fixed over there

@roryabraham roryabraham changed the title Deleted message disappear for a moment when transistioning from offline to online [HOLD] Deleted message disappear for a moment when transistioning from offline to online Apr 3, 2024
@bernhardoj
Copy link
Contributor

Proposal

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

Deleted thread parent message disappears when go online instead of showing [Deleted message]

What is the root cause of that problem?

In ReportActionsList, we are filtering out any action that has a pending action of DELETE.

const sortedVisibleReportActions = useMemo(
() =>
sortedReportActions.filter(
(reportAction) =>
(isOffline || reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || reportAction.errors) &&
ReportActionsUtils.shouldReportActionBeVisible(reportAction, reportAction.reportActionID),
),

It's not happening while offline because we include isOffline condition on the filter logic. The filter was first introduced in #31670 and the filtered report actions were previously used only in this useEffect.

useEffect(() => {
if (
scrollingVerticalOffset.current < AUTOSCROLL_TO_TOP_THRESHOLD &&
previousLastIndex.current !== lastActionIndex &&
reportActionSize.current > sortedVisibleReportActions.length &&
hasNewestReportAction
) {
reportScrollManager.scrollToBottom();
}
previousLastIndex.current = lastActionIndex;
reportActionSize.current = sortedVisibleReportActions.length;
}, [lastActionIndex, sortedVisibleReportActions, reportScrollManager, hasNewestReportAction, linkedReportActionID]);

But after the comment linking, we add ReportActionsUtils.shouldReportActionBeVisible condition and use it to render the list items too. We add ReportActionsUtils.shouldReportActionBeVisible because the report actions from the report screen include all actions.

selector: (allReportActions: OnyxEntry<OnyxTypes.ReportActions>) => ReportActionsUtils.getSortedReportActionsForDisplay(allReportActions, true),

function getSortedReportActionsForDisplay(reportActions: ReportActions | null | ReportAction[], shouldIncludeInvisibleActions = false): ReportAction[] {
let filteredReportActions: ReportAction[] = [];
if (!reportActions) {
return [];
}
if (shouldIncludeInvisibleActions) {
filteredReportActions = Object.values(reportActions);
} else {
filteredReportActions = Object.entries(reportActions)
.filter(([key, reportAction]) => shouldReportActionBeVisible(reportAction, key))

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

First of all, whether we use sortedVisibleReportActions to render the list or not, the first filter condition is not complete
(isOffline || reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || reportAction.errors)

because we don't consider the case for deleted parent action (isDeletedParentAction).

So, my suggestion is to include ReportActionsUtils.isDeletedParentAction(reportAction) condition.

-(isOffline || reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || reportAction.errors)
+(isOffline || ReportActionsUtils.isDeletedParentAction(reportAction) || reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || reportAction.errors)

This is enough, but if we see the above condition, it's similar to shouldReportActionBeVisible.

const isDeleted = isDeletedAction(reportAction);
const isPending = !!reportAction.pendingAction;
return !isDeleted || isPending || isDeletedParentAction(reportAction) || isReversedTransaction(reportAction);

The main difference is, shouldReportActionBeVisible includes all action with pending action of DELETE. I'm thinking of updating shouldReportActionBeVisible to include pending action of DELETE only while offline so we don't need to use the first condition, but I'm not sure because shouldReportActionBeVisible is being used in many places and I don't know what regression would wait us.

@shubham1206agra
Copy link
Contributor

@bernhardoj's proposal looks good.

🎀 👀 🎀 C+ Reviewed

@roryabraham
Copy link
Contributor

next step - waiting for @bernhardoj to open a PR

@bernhardoj
Copy link
Contributor

Sorry for the delay, PR is ready for review

cc: @shubham1206agra

Copy link

melvin-bot bot commented May 16, 2024

This issue has not been updated in over 15 days. @sonialiap, @roryabraham, @bernhardoj, @shubham1206agra eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@melvin-bot melvin-bot bot added the Monthly KSv2 label May 16, 2024
@roryabraham
Copy link
Contributor

PR was deployed to prod a week ago. Ready to pay.

@roryabraham roryabraham added External Added to denote the issue can be worked on by a contributor and removed Reviewing Has a PR in review labels May 30, 2024
@melvin-bot melvin-bot bot changed the title Deleted message disappear for a moment when transistioning from offline to online [$250] Deleted message disappear for a moment when transistioning from offline to online May 30, 2024
Copy link

melvin-bot bot commented May 30, 2024

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

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

melvin-bot bot commented May 30, 2024

Current assignee @shubham1206agra is eligible for the External assigner, not assigning anyone new.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Monthly KSv2 labels May 30, 2024
@roryabraham roryabraham added Awaiting Payment Auto-added when associated PR is deployed to production and removed Help Wanted Apply this label when an issue is open to proposals by contributors labels May 30, 2024
@sonialiap sonialiap changed the title [$250] Deleted message disappear for a moment when transistioning from offline to online [Hold for payment 2024-05-30][$250] Deleted message disappear for a moment when transistioning from offline to online May 31, 2024
@sonialiap
Copy link
Contributor

sonialiap commented May 31, 2024

Payment summary:

@shubham1206agra
Copy link
Contributor

@sonialiap I think the issue was created before the April 6 deadline. The bounty should be $500 here.

@sonialiap
Copy link
Contributor

sonialiap commented May 31, 2024

@shubham1206agra updated :)

@shubham1206agra
Copy link
Contributor

@sonialiap Accepted

@sonialiap
Copy link
Contributor

paid ✔️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Development

No branches or pull requests

9 participants