Skip to content

[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

Description

@izarutskaya

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

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 27, 2023
  2. melvin-bot commented on Oct 27, 2023

    @melvin-bot

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

  3. melvin-bot commented on Oct 27, 2023

    @melvin-bot

    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
  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 27, 2023
  5. 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[/+] on Oct 27, 2023
  6. melvin-bot commented on Oct 27, 2023

    @melvin-bot
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 27, 2023
  8. melvin-bot commented on Oct 27, 2023

    @melvin-bot

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

  9. paultsimura commented on Oct 27, 2023

    @paultsimura
    Contributor

    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)

  10. getusha commented on Oct 27, 2023

    @getusha
    Contributor

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

  11. paultsimura commented on Oct 27, 2023

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

  12. getusha commented on Oct 27, 2023

    @getusha
    Contributor

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

  13. 32 remaining items

  14. melvin-bot commented on Dec 5, 2023

    @melvin-bot

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

  15. melvin-bot commented on Dec 5, 2023

    @melvin-bot

    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:

  16. melvin-bot commented on Dec 5, 2023

    @melvin-bot

    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
  17. joekaufmanexpensify commented on Dec 11, 2023

    @joekaufmanexpensify
    Contributor

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

  18. joekaufmanexpensify commented on Dec 12, 2023

    @joekaufmanexpensify
    Contributor

    Bumped in Slack

  19. getusha commented on Dec 12, 2023

    @getusha
    Contributor

    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.
  20. joekaufmanexpensify commented on Dec 12, 2023

    @joekaufmanexpensify
    Contributor

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

  21. joekaufmanexpensify commented on Dec 12, 2023

    @joekaufmanexpensify
    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.
  22. joekaufmanexpensify commented on Dec 12, 2023

    @joekaufmanexpensify
    Contributor

    @paultsimura $250 sent and contract ended!

  23. joekaufmanexpensify commented on Dec 12, 2023

    @joekaufmanexpensify
    Contributor

    @getusha $250 sent and contract ended!

  24. joekaufmanexpensify commented on Dec 12, 2023

    @joekaufmanexpensify
    Contributor

    All set. TY everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions