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 2023-08-17] [$1000] Chat - Infinite loading after selecting flag option offline #23125

Closed
1 of 6 tasks
lanitochka17 opened this issue Jul 18, 2023 · 47 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Monthly KSv2 Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 18, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Issue found when executing PR #22771

Action Performed:

Precondition: user is logged in on two platforms with different accounts

  1. Open the app logged in with Account A
  2. On a different device, send a message from Account B to Account A
  3. Open the chat as Account A
  4. Turn off wifi or mobile data
  5. Tap the message and select "Reply in thread"
  6. Send a message in the thread
  7. Return to the report
  8. Tap the message and select "Flag as offensive"

Expected Result:

The reasons for flagging are displayed

Actual Result:

Infinite loading when selecting "Flag as offensive"

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.42.18

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

Notes/Photos/Videos: Any additional supporting documentation

Bug6132837_IMG_0533.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d1f8e9ce942eb648
  • Upwork Job ID: 1681531600613777408
  • Last Price Increase: 2023-07-26
  • Automatic offers:
    • fedirjh | Reviewer | 25865636
    • dukenv0307 | Contributor | 25865637
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 18, 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

@Nodebrute
Copy link
Contributor

Proposal

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

Chat - Infinite loading after selecting flag option offline

What is the root cause of that problem?

When we open report isLoadingReportAction is true

isLoadingReportActions: true,

In flag comment this make this condition true hence the instead of page we have a loading indicator

const shouldShowLoading = props.isLoadingReportData || props.report.isLoadingReportActions;

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

Solution 1:

We can remove props.report.isLoadingReportActions from here

const shouldShowLoading = props.isLoadingReportData || props.report.isLoadingReportActions;

Or we can use && instead of ||

What alternative solutions did you explore? (Optional)

@s-alves10
Copy link
Contributor

Proposal

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

Selecting flag option shows infinite loading in offline mode

What is the root cause of that problem?

We're showing Loader here

const shouldShowLoading = props.isLoadingReportData || props.report.isLoadingReportActions;
if (shouldShowLoading) {
return <FullscreenLoadingIndicator />;
}

We set report.isLoadingReportActions to true when we open report and set isLoadingReportData when we reconnect app.
In offline mode, openReport API isn't called but isLoadingReportActions is set optimistically. That's why we see the infinite loader.

This is from this PR

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

We have reportID and reportActionID(from the route). I think we should be able to flag comments as long as we have corresponding report and reportAction.

So I suggest to remove the above code completely(L150-L153)

This works as expected.

What alternative solutions did you explore? (Optional)

@dukenv0307
Copy link
Contributor

dukenv0307 commented Jul 19, 2023

Proposal

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

Chat - Infinite loading after selecting flag option offline

What is the root cause of that problem?

Let's see the condition to display FullscreenLoadingIndicator

const shouldShowLoading = props.isLoadingReportData || props.report.isLoadingReportActions;
if (shouldShowLoading) {
return <FullscreenLoadingIndicator />;
}

We are setting isLoadingReportActions: true in optimisticData of openReport API

isLoadingReportActions: true,

but when offline the API is not sent so both successData and failureData are not updated. So, isLoadingReportActions still be true

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

const shouldShowLoading = props.isLoadingReportData || props.report.isLoadingReportActions;
if (shouldShowLoading) {
return <FullscreenLoadingIndicator />;
}

We need to show loadingPage here because in case the user access to FlagCommentPage by link, then there are 2 scenarios

  1. User has permission to flag a comment
  2. User has not permission to flag comments (in case the user wants to flag their own comment)

This is the reason why we need to show loadingPage while we wait for data and decide which scenario happen
We only should show FullscreenLoadingIndicator if report is empty and isLoadingReportData is true or if reportActions is empty and isLoadingReportActions is true. Update like this code

const shouldShowLoading = (props.isLoadingReportData && isEmpty(props.report) || (isEmpty(props.reportActions) && props.report.isLoadingReportActions) 

What alternative solutions did you explore? (Optional)

Access to FlagCommentPage by link only happens while the user is online so I suggest we only should show FullscreenLoadingIndicator while online, update like this code

const shouldShowLoading = (props.isLoadingReportData || props.report.isLoadingReportActions) && !props.network.isOffline

@tjferriss tjferriss added the External Added to denote the issue can be worked on by a contributor label Jul 19, 2023
@melvin-bot melvin-bot bot changed the title Chat - Infinite loading after selecting flag option offline [$1000] Chat - Infinite loading after selecting flag option offline Jul 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 19, 2023

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

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

melvin-bot bot commented Jul 19, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 19, 2023

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

@eh2077
Copy link
Contributor

eh2077 commented Jul 20, 2023

Proposal

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

Infinite loading after selecting flag option offline.

What is the root cause of that problem?

The root cause of this issue is that

  1. We set optimistic isLoadingReportActions to true when open a report
  2. In offline mode, isLoadingReportActions of the report remains true, so following snippet will show the infinite loading

const shouldShowLoading = props.isLoadingReportData || props.report.isLoadingReportActions;
if (shouldShowLoading) {
return <FullscreenLoadingIndicator />;
}

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

The expected behaviours should be

  1. In offline mode, the flag options should be shown and is able to flag, which will update to backend after online.
  2. If report is loading, isLoadingReportData is true, we should show loading indicator
  3. If report or action to flag is empty, then we should show FullPageNotFoundView

To achieve it, we can

  1. Remove following snippet

    const shouldShowLoading = props.isLoadingReportData || props.report.isLoadingReportActions;
    if (shouldShowLoading) {
    return <FullscreenLoadingIndicator />;
    }

  2. Change this line

    <FullPageNotFoundView shouldShow={!shouldShowLoading && !ReportUtils.shouldShowFlagComment(getActionToFlag(), props.report)}>

    to

    <FullPageNotFoundView shouldShow={_.isEmpty(props.report) || _.isEmpty(getActionToFlag()) || !ReportUtils.shouldShowFlagComment(getActionToFlag(), props.report)}>
  3. Add

    withReportOrNotFound,

    below this line

    withLocalize,

    and remove

    isLoadingReportData: {
    key: ONYXKEYS.IS_LOADING_REPORT_DATA,
    },

The usage of withReportOrNotFound and FullPageNotFoundView is similar to SplitBillDetailsPage.js

What alternative solutions did you explore? (Optional)

N/A

@melvin-bot melvin-bot bot added the Overdue label Jul 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 21, 2023

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

@fedirjh
Copy link
Contributor

fedirjh commented Jul 21, 2023

Reviewing shortly.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jul 21, 2023
@rk111
Copy link

rk111 commented Jul 24, 2023

Proposal

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

Chat - Infinite loading after selecting flag option offline

What is the root cause of that problem?

FullscreenLoadingIndicator on the FlagCommentPage is not handling the scenario where the user is offline and the API call is not sent. Specifically, when the user is offline, the API call to update the report actions is not made, and as a result, the isLoadingReportActions flag remains true, causing the loading indicator to persist indefinitely.

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

Update the condition for shouldShowLoading to consider the scenario where the user is offline and the API call is not made. We should show the loadingPage when either of the following conditions is true:
a. isLoadingReportData is true, and the report data is empty (props.isLoadingReportData && isEmpty(props.report))
b. isLoadingReportActions is true, and the reportActions data is empty (isEmpty(props.reportActions) && props.report.isLoadingReportActions)

To address the scenario where the user accesses the FlagCommentPage by link while online, show the FullscreenLoadingIndicator only when the user is online. Update the condition to include a check for the network status:
(props.isLoadingReportData || props.report.isLoadingReportActions) && !props.network.isOffline

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

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

@tjferriss
Copy link
Contributor

Easy, MelvinBot. @fedirjh is reviewing proposals.

@melvin-bot melvin-bot bot removed the Overdue label Jul 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 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 Jul 27, 2023

@dukenv0307 It seems to be a regression from your PR, I have raised a question in the PR about the FullscreenLoadingIndicator, Can you please share any inputs on why it was implemented?

@dukenv0307
Copy link
Contributor

@fedirjh I replied in the PR. Can you check again.

@dukenv0307
Copy link
Contributor

@fedirjh The fix that I mentioned in the PR is my proposal of this issue. What do you think about it?

@fedirjh
Copy link
Contributor

fedirjh commented Jul 30, 2023

Thanks for reviewing proposals. Can I have your feedback about my #23125 (comment).

@eh2077 Your proposal doesn’t cover the case when we don't have report action and we deep link, it will display 'not found' view for a brief moment before rendering the flag comment component and that's not expected.

The transition should be expected right?

Nope, it doesn’t make sense to display not found then found, it should be loading then found or not found. The expected transition is that we display a skeleton view until the data is loaded and given that we have not implemented that yet, we should display the loading indicator.

@srikarparsi
Copy link
Contributor

Looks good to me as well, thanks @fedirjh and @dukenv0307!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 31, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 31, 2023

📣 @fedirjh 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot
Copy link

melvin-bot bot commented Jul 31, 2023

📣 @dukenv0307 🎉 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 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 1, 2023
@dukenv0307
Copy link
Contributor

@fedirjh The PR is ready for review.

@fedirjh
Copy link
Contributor

fedirjh commented Aug 2, 2023

Update: We are currently facing a similar issue that also impacts the split bill detail page #23568. In this PR, we plan to introduce a new HOC named withReportAndReportActionOrNotFound. This HOC will contain the same code as the one mentioned in this issue. To prevent redundant code, we will hold the PR until the new HOC is created, and then we will use it within the FlagCommentPage page.

@melvin-bot
Copy link

melvin-bot bot commented Aug 8, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @dukenv0307 got assigned: 2023-07-31 21:19:57 Z
  • when the PR got merged: 2023-08-08 05:44:00 UTC
  • days elapsed: 5

On to the next one 🚀

@dukenv0307
Copy link
Contributor

@fedirjh @srikarparsi This PR is on hold from August 1 to August 4. So I think we are eligible for a bonus timeline

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 10, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Chat - Infinite loading after selecting flag option offline [HOLD for payment 2023-08-17] [$1000] Chat - Infinite loading after selecting flag option offline Aug 10, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 10, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 10, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented Aug 10, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.52-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-08-17. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter NA Applause
  • Contributor that fixed the issue @dukenv0307 $1000
  • Contributor+ that helped on the issue and/or PR @fedirjh $1000

For reference, here are some details about the assignees on this issue:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Aug 10, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@fedirjh] The PR that introduced the bug has been identified. Link to the PR:
  • [@fedirjh] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@fedirjh] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@fedirjh] Determine if we should create a regression test for this bug.
  • [@fedirjh] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@tjferriss] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added the Monthly KSv2 label Aug 10, 2023
@tjferriss
Copy link
Contributor

@fedirjh and @dukenv0307 are both hired in Upworks: https://www.upwork.com/ab/applicants/1681531600613777408/hired. We're waiting on the regression period now.

@fedirjh can you get started on the checklist when you have a minute?

@fedirjh
Copy link
Contributor

fedirjh commented Aug 17, 2023

BugZero Checklist:

  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • Determine if we should create a regression test for this bug: yes

Regression Test Proposal

  1. From user A, send a new message to user B
  2. From user B, go offline
  3. Open a different report than user A
  4. Go back to the report with user A
  5. Tap the message and select "Flag as offensive"
  6. Verify that the flag page appears instead of loading infinitely

Do we agree 👍 or 👎

@tjferriss
Copy link
Contributor

The payments have been sent via Upworks and QA issue created.

@dukenv0307
Copy link
Contributor

@tjferriss Can you please check my comment above #23125 (comment).

@tjferriss
Copy link
Contributor

@dukenv0307 yes, that looks right. I've paid the bonus to both of you via Upworks.

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. External Added to denote the issue can be worked on by a contributor Monthly KSv2 Weekly KSv2
Projects
None yet
Development

No branches or pull requests

9 participants