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

[$500] mWeb/Chrome - Chat – Deleted message appears briefly when navigate via IOU link after re-login. #33144

Closed
1 of 6 tasks
izarutskaya opened this issue Dec 15, 2023 · 29 comments
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

@izarutskaya
Copy link

izarutskaya commented Dec 15, 2023

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: v1.4.13-2
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: Applause-Internal Team
Slack conversation: @

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. As account A, create an IOU with account B.
  3. Navigate to the IOU details page and copy the URL.
  4. Log out.
  5. Log in with the same account or account B and navigate to the copied URL.

Expected Result:

IOU link opens.

Actual Result:

Deleted message appears briefly in a chat when navigate via IOU link after re-login.

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

Bug6314216_1702630093991.Deleted_message.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010bcca99fc0ffe3ae
  • Upwork Job ID: 1735598780619743232
  • Last Price Increase: 2023-12-29
@izarutskaya izarutskaya added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 15, 2023
Copy link

melvin-bot bot commented Dec 15, 2023

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

@melvin-bot melvin-bot bot changed the title mWeb/Chrome - Chat – Deleted message appears briefly when navigate via IOU link after re-login. [$500] mWeb/Chrome - Chat – Deleted message appears briefly when navigate via IOU link after re-login. Dec 15, 2023
Copy link

melvin-bot bot commented Dec 15, 2023

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

Copy link

melvin-bot bot commented Dec 15, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 15, 2023
Copy link

melvin-bot bot commented Dec 15, 2023

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

@bernhardoj
Copy link
Contributor

bernhardoj commented Dec 15, 2023

Proposal

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

[Delete message] shows in the money request detail header after login.

What is the root cause of that problem?

The header should show the transaction name if it is working correctly.

App/src/libs/ReportUtils.ts

Lines 2261 to 2263 in 8bef4bb

if (isNotEmptyObject(parentReportAction) && ReportActionsUtils.isTransactionThread(parentReportAction)) {
return getTransactionReportName(parentReportAction);
}

But the parentReportAction is empty, so the header will show [Deleted message].

return parentReportActionMessage || Localize.translateLocal('parentReportAction.deletedMessage');

Even when the report loading is complete, the parentReportAction is not immediately available. From my findings, when we open the transaction report/thread, it will call the OpenReport API and it will return the transaction report data along with the parent report action data. But it takes time to merge them all, so we can briefly see the [Deleted message].

Screenshot 2023-12-15 at 18 42 00

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

If the report has a parentReportID and parentReportActionID, keep showing the skeleton loader until the parent report action is available.

The code will look like this:

(props.report && props.report.parentReportID && props.report.parentReportActionID && _.isEmpty(ReportActionsUtils.getParentReportAction(props.report)))

@yh-0218
Copy link
Contributor

yh-0218 commented Dec 15, 2023

Proposal

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

[Delete message] shows in the money request detail header after login.

What is the root cause of that problem?

Report actions is slowly loaded than reports.
Transaction title should returned here

return getTransactionReportName(parentReportAction);

But returned here because parentReportAction is empty
return parentReportActionMessage || Localize.translateLocal('parentReportAction.deletedMessage');

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

We need to check all actions is loaded before returning.

       const allReportActions = ReportActionsUtils.getAllReportActions(report.reportID);
        if(!parentReportActionMessage && isEmptyObject(allReportActions)) {
            return '';
        }

We need to add this code before return delete title.

return parentReportActionMessage || Localize.translateLocal('parentReportAction.deletedMessage');

when we return '', header will be shown as loading.

What alternative solutions did you explore? (Optional)

Screen.Recording.2023-12-15.at.1.06.23.PM.mov

@melvin-bot melvin-bot bot added the Overdue label Dec 18, 2023
Copy link

melvin-bot bot commented Dec 18, 2023

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

@fedirjh
Copy link
Contributor

fedirjh commented Dec 18, 2023

@bernhardoj Thanks for the proposal.

The code will look like this:

Where this code should be placed ?

@melvin-bot melvin-bot bot removed the Overdue label Dec 18, 2023
@fedirjh
Copy link
Contributor

fedirjh commented Dec 18, 2023

@yh-0218 Thanks for the proposal.

Report actions is slowly loaded than reports.

What does it means slowly loaded in this case ?

We need to check all actions is loaded before returning.

Can you elaborate more on this point ? How to check if all actions are loaded ?

@yh-0218
Copy link
Contributor

yh-0218 commented Dec 18, 2023

I got const allReportActions = ReportActionsUtils.getAllReportActions(report.reportID);
When we get props.report value on HeaderView, allReportActions of ReportActionsUtils is {} during very short time.
This time is long on Android(because android is slow).
so we get return value here.

return parentReportActionMessage || Localize.translateLocal('parentReportAction.deletedMessage');

Because of ParentReportAction is {}, we get deleted message.
So during allReportActions is {} (very short time), I returned '' value.
when title is '', HeaderView is on loading status.
When allReportActions has value, then we can get correct title.

@fedirjh

@yh-0218
Copy link
Contributor

yh-0218 commented Dec 18, 2023

const parentReportAction = ReportActionsUtils.getParentReportAction(report);

We get parentReportAction to get title, but above code is available when allReportActions of ReportActionsUtils has value.
So I checked that value.

@fedirjh
Copy link
Contributor

fedirjh commented Dec 18, 2023

const allReportActions = ReportActionsUtils.getAllReportActions(report.reportID);
if(!parentReportActionMessage && isEmptyObject(parentReportAction)) {
return '';
}

@yh-0218 you get allReportActions but you didn’t use it in your code , that’s confusing.

@bernhardoj
Copy link
Contributor

@fedirjh we will put it in HeaderView and ReportScreen.

const isLoading = !props.report || !title;
return (
<View
style={[styles.appContentHeader, shouldShowBorderBottom && styles.borderBottom]}
dataSet={{dragArea: true}}
>
<View style={[styles.appContentHeaderTitle, !isSmallScreenWidth && !isLoading && styles.pl5]}>
{isLoading ? (
<ReportHeaderSkeletonView onBackButtonPress={props.onNavigationMenuButtonClicked} />
) : (

const isLoading = !reportID || !isSidebarLoaded || _.isEmpty(personalDetails);

{(!isReportReadyForDisplay || isLoadingInitialReportActions || isLoading) && <ReportActionsSkeletonView />}

@yh-0218
Copy link
Contributor

yh-0218 commented Dec 19, 2023

const allReportActions = ReportActionsUtils.getAllReportActions(report.reportID);
if(!parentReportActionMessage && isEmptyObject(allReportActions)) {
    return '';
}

Sorry @fedirjh
My mistake to create proposal.
We need to check allReportActions is empty.

@melvin-bot melvin-bot bot added the Overdue label Dec 21, 2023
Copy link

melvin-bot bot commented Dec 22, 2023

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

Copy link

melvin-bot bot commented Dec 22, 2023

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

@NicMendonca
Copy link
Contributor

@fedirjh proposals for you! ^

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Dec 22, 2023
Copy link

melvin-bot bot commented Dec 26, 2023

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

Copy link

melvin-bot bot commented Dec 28, 2023

@NicMendonca, @fedirjh Huh... This is 4 days overdue. Who can take care of this?

Copy link

melvin-bot bot commented Dec 29, 2023

@NicMendonca @fedirjh this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

Copy link

melvin-bot bot commented Dec 29, 2023

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

@fedirjh
Copy link
Contributor

fedirjh commented Dec 30, 2023

@bernhardoj @yh-0218 Why the skeleton is not diplayed when the parentReportAction is empty ? So if there was a delay with Onyx then it should display the skeleton in the meantime. it seems that there is something wrong with rendering cycle .

@melvin-bot melvin-bot bot removed the Overdue label Dec 30, 2023
@bernhardoj
Copy link
Contributor

@fedirjh you mean you still didn't see the skeleton after applying the solution? If yes, I don't know if it gonna help but can you try to subscribe to the parentReportActions onyx?

parentReportActions: {
    key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID}`,
    canEvict: false,
},

Then, you can do this to get the specific parent report action.

const parentReportAction = props.parentReportActions[`${props.report.parentReportActionID}`];

theoritically, you should see the skeleton without the above code, but we still need to apply the above code at the end
The code I wrote in the proposal is just to make it simple.

@melvin-bot melvin-bot bot added the Overdue label Jan 1, 2024
@fedirjh
Copy link
Contributor

fedirjh commented Jan 2, 2024

you mean you still didn't see the skeleton after applying the solution?

@bernhardoj Not really, what I meant is that if the data is in loading state then why getReportName is called ? then I just realised that the report is loaded but the parentReportAction is not loaded yet.

So the problem is within this line :

return parentReportActionMessage || Localize.translateLocal('parentReportAction.deletedMessage');

we assume that empty parentReportActionMessage means the report is deleted, but we didn’t consider the case when the parentReportAction is still loading.

@melvin-bot melvin-bot bot removed the Overdue label Jan 2, 2024
Copy link

melvin-bot bot commented Jan 2, 2024

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

@fedirjh
Copy link
Contributor

fedirjh commented Jan 2, 2024

This is quite tricky.

@bernhardoj , I believe your solution may not be correct. I suspect it could fail in the case of a deleted parent report action, which would result in the skeleton being displayed indefinitely. I think we should also check whether the parentReportAction has been deleted or not. Is that possible?

@yh-0218, your solution makes sense, but the code does not appear to be correct. As @bernhardoj mentioned, we should verify whether the report contains both a parentReportID and a parentReportActionID. We will use the parentReportID to retrieve the parent report action, not the reportID.

@bernhardoj
Copy link
Contributor

I suspect it could fail in the case of a deleted parent report action, which would result in the skeleton being displayed indefinitely

From my testing, if the parent action is deleted, the action still exists, only the message is deleted.

Here is how the action object looks on a normal thread
image

Here is how the action object looks on a transaction (IOU) thread
image

@yh-0218
Copy link
Contributor

yh-0218 commented Jan 3, 2024

@fedirjh I think this is good way.

if(report?.parentReportID && report?.parentReportActionID && isEmptyObject(parentReportAction)) {
    return '';
}

@NicMendonca
Copy link
Contributor

Navigate to the IOU details page and copy the URL.
Log out
Log in with the same account or account B and navigate to the copied URL

^ I am not sure how common of a practice this is going to be for end-users.

So with that, I am going to close this based on this -- https://expensify.slack.com/archives/C01GTK53T8Q/p1702496349813859

Since this is not directly related to a roadmap feature.

Appreciate the discussion so far!

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
None yet
Development

No branches or pull requests

5 participants