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-12-12] [hold for payment 2023-11-16] [$500] Chat - Skeleton placeholder flickers when opening chat with IOU in offline mode #30503

Closed
2 of 6 tasks
izarutskaya opened this issue Oct 27, 2023 · 36 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 External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Oct 27, 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 #29643

Version Number: v1.3.92-0
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:

Precondition:

  • There must be a user with existing unpaid IOU.
  • Log out and log in again and do not open the chat report with the user that has existing IOU.
  1. Go offline.
  2. Go to + > Request money > Manual.
  3. Request money from the user in the precondition.
  4. If there is no flickering, click on the IOU preview to open IOU report.

Expected Result:

Skeleton placeholder should not flicker.

Actual Result:

Skeleton placeholder flickers.

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

Android: Native
Bug6253007_1698395284540.Screen_Recording_20231027_094427_New_Expensify.mp4
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01caf37bfdd026bf43
  • Upwork Job ID: 1717876350080266240
  • Last Price Increase: 2023-10-27
  • Automatic offers:
    • getusha | Reviewer | 27461954
    • paultsimura | Contributor | 27461958
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 27, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 27, 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

@izarutskaya izarutskaya added the External Added to denote the issue can be worked on by a contributor label Oct 27, 2023
@melvin-bot melvin-bot bot changed the title Chat - Skeleton placeholder flickers when opening chat with IOU in offline mode [$500] Chat - Skeleton placeholder flickers when opening chat with IOU in offline mode Oct 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 27, 2023

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

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

melvin-bot bot commented Oct 27, 2023

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

@paultsimura
Copy link
Contributor

paultsimura commented Oct 27, 2023

Proposal

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

Chat: the top skeleton loader flickers when offline

What is the root cause of that problem?

The root cause is that we run into an infinite loop of Report.getOlderActions API calls here:

const loadOlderChats = () => {
// Only fetch more if we are not already fetching so that we don't initiate duplicate requests.
if (props.isLoadingOlderReportActions) {
return;
}
const oldestReportAction = _.last(props.reportActions);
// Don't load more chats if we're already at the beginning of the chat history
if (oldestReportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) {
return;
}
// Retrieve the next REPORT.ACTIONS.LIMIT sized page of comments
Report.getOlderActions(reportID, oldestReportAction.reportActionID);
};

When the reproduction steps are met, the API call responds with the following error:

{
    "code": 666,
    "jsonCode": 666,
    "message": "No report actions returned in Auth response"
}

This leads to the isLoadingOlderReportActions being set to true as a failure data, and the Report.getOlderActions being triggered again, which results in a loop.

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

First, add the following variable:

    const isFetchedTillBeginning = useMemo(
        () => _.last(props.reportActions).actionName === CONST.REPORT.ACTIONS.TYPE.CREATED,
        [props.reportActions]
    );

Second, we should make the actual API call only if we are online:

    const loadOlderChats = () => {
        // Only fetch more if we are not already fetching so that we don't initiate duplicate requests.
-        if (props.isLoadingOlderReportActions) {
+        if (isOffline || props.isLoadingOlderReportActions) {
            return;
        }

        // Don't load more chats if we're already at the beginning of the chat history
-        const oldestReportAction = _.last(props.reportActions);
-        if (oldestReportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) {
+        if (isFetchedTillBeginning) {
            return;
        }
        // Retrieve the next REPORT.ACTIONS.LIMIT sized page of comments
+        const oldestReportAction = _.last(props.reportActions);
        Report.getOlderActions(reportID, oldestReportAction.reportActionID);
    };

Third, show the loader if either the actions are being loaded via API, or we are offline and should load the actions:

    return (
        <>
            <ReportActionsList
                report={props.report}
                onLayout={recordTimeToMeasureItemLayout}
                sortedReportActions={props.reportActions}
                mostRecentIOUReportActionID={mostRecentIOUReportActionID}
                loadOlderChats={loadOlderChats}
                loadNewerChats={loadNewerChats}
                isLoadingInitialReportActions={props.isLoadingInitialReportActions}
-                isLoadingOlderReportActions={props.isLoadingOlderReportActions}
+                isLoadingOlderReportActions={props.isLoadingOlderReportActions || isOffline && !isFetchedTillBeginning}
                isLoadingNewerReportActions={props.isLoadingNewerReportActions}
                policy={props.policy}
            />
            <PopoverReactionList ref={reactionListRef} />
        </>
    );

What alternative solutions did you explore? (Optional)

@getusha
Copy link
Contributor

getusha commented Oct 27, 2023

@paultsimura do you have any explanation on why this issue is not happening on web but only on native?

@paultsimura
Copy link
Contributor

@getusha this happens on the Web as well, it's just more difficult to catch: loadOlderChats is called on InvertedFlatList.onEndReached:

onEndReached={loadOlderChats}

You need to make the screen on the web really short, so the onEndReached is triggered, and you'll see both the flickering and the loop in Network tab:

Screen.Recording.2023-10-27.at.17.17.09.mov

Also, I've updated my proposal with some extra details.

@getusha
Copy link
Contributor

getusha commented Oct 27, 2023

Thanks @paultsimura! tried applying your solution seems like i have an outdated branch, could you please your branch so i can test it?

@paultsimura
Copy link
Contributor

@getusha
Copy link
Contributor

getusha commented Oct 28, 2023

Proposal from @paultsimura works well and looks good to me.
🎀 👀 🎀 C+ Reviewed

@melvin-bot
Copy link

melvin-bot bot commented Oct 28, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Oct 30, 2023
@joekaufmanexpensify
Copy link
Contributor

Pending internal engineering sign off

@melvin-bot melvin-bot bot removed the Overdue label Oct 30, 2023
@paultsimura
Copy link
Contributor

I've recently seen a PR pending a review from @aldo-expensify for a month already. Just wanted to confirm he's not OOO at the moment

@aldo-expensify
Copy link
Contributor

I was OOO for 3 weeks, but I just came back today. I'm catching up with pending stuff, I'll try to review the PR today

@joekaufmanexpensify
Copy link
Contributor

TY!

@paultsimura
Copy link
Contributor

Thank you @aldo-expensify, would appreciate if you could give a look on this issue as well — it's waiting for your assignment 🙏🏼

@aldo-expensify
Copy link
Contributor

Thanks for pinging me again, I thought that the linked PR was all there was left to do hahaha

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

melvin-bot bot commented Oct 31, 2023

📣 @getusha 🎉 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

@joekaufmanexpensify
Copy link
Contributor

PR is out on production. Not sure why the automation didn't work. Payment is due (assuming no regressions) on 2023-11-16

@joekaufmanexpensify joekaufmanexpensify changed the title [$500] Chat - Skeleton placeholder flickers when opening chat with IOU in offline mode [hold for payment 2023-11-16] [$500] Chat - Skeleton placeholder flickers when opening chat with IOU in offline mode Nov 13, 2023
@joekaufmanexpensify
Copy link
Contributor

Looks like a regression came up here, @paultsimura / @getusha could you take a look?

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Nov 17, 2023
@joekaufmanexpensify
Copy link
Contributor

Resolving regression in the above thread

@joekaufmanexpensify
Copy link
Contributor

Same

@joekaufmanexpensify
Copy link
Contributor

PR fixing regression is out on staging.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Dec 5, 2023
@melvin-bot melvin-bot bot changed the title [hold for payment 2023-11-16] [$500] Chat - Skeleton placeholder flickers when opening chat with IOU in offline mode [HOLD for payment 2023-12-12] [hold for payment 2023-11-16] [$500] Chat - Skeleton placeholder flickers when opening chat with IOU in offline mode Dec 5, 2023
Copy link

melvin-bot bot commented Dec 5, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 5, 2023
Copy link

melvin-bot bot commented Dec 5, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.7-4 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-12-12. 🎊

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
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

Copy link

melvin-bot bot commented Dec 5, 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:

  • [@getusha] The PR that introduced the bug has been identified. Link to the PR: Bidirectional pagination #26166
  • [@getusha] 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: https://github.com/Expensify/App/pull/26166/files#r1424177004
  • [@getusha] 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: N/A
  • [@getusha] Determine if we should create a regression test for this bug.
  • [@getusha] 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.
  • [@joekaufmanexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: N/A

@joekaufmanexpensify
Copy link
Contributor

@getusha could you please complete the BZ checklist so we can issue payment tomorrow?

@joekaufmanexpensify
Copy link
Contributor

Bumped in Slack

@getusha getusha mentioned this issue Dec 12, 2023
59 tasks
@getusha
Copy link
Contributor

getusha commented Dec 12, 2023

BugZero Checklist:

  • The PR that introduced the bug has been identified. Link to the PR: Bidirectional pagination #26166
  • 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: https://github.com/Expensify/App/pull/26166/files#r1424177004
  • 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: N/a
  • Determine if we should create a regression test for this bug. No, this is a minor visual issue which will not affect any user flow.
  • 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.

@joekaufmanexpensify
Copy link
Contributor

Great, TY! BZ checklist is complete. All set to issue payment.

@joekaufmanexpensify
Copy link
Contributor

We need to make the following payments here:

  • @paultsimura - $250 for PR (50% regression penalty applied). Paid via upwork.
  • @getusha - $250 for C+ review (50% regression penalty applied). Paid via upwork.

@joekaufmanexpensify
Copy link
Contributor

@paultsimura $250 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

@getusha $250 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

All set. TY everyone!

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

No branches or pull requests

5 participants