Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.34k stars 2.77k forks source link

[HOLD for payment 2023-12-12] [$500] Chat - No skeleton loading when scrolling up the chat history offline until the chat is reopened #31367

Closed kbecciv closed 9 months ago

kbecciv commented 10 months ago

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


Version Number: 1.3.99.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:

  1. Launch New Expensify app.
  2. Log in to HT account.
  3. Open a chat that has long chat history.
  4. Go offline.
  5. Scroll to the top.
  6. Return to LHN.
  7. Reopen the chat in Step 2 and scroll to the top.

Expected Result:

In Step 5, skeleton placeholder will appear.

Actual Result:

In Step 5, skeleton placeholder does not appear. It only appears when the chat is revisited in Step 7.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/93399543/05c4f8c8-1320-49d7-bbe6-3b31cf508638

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01073572ec47fdb07b
  • Upwork Job ID: 1724786009891438592
  • Last Price Increase: 2023-11-15
  • Automatic offers:
    • paultsimura | Contributor | 28015843
melvin-bot[bot] commented 10 months ago

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

melvin-bot[bot] commented 10 months ago

Job added to Upwork: https://www.upwork.com/jobs/~01073572ec47fdb07b

melvin-bot[bot] commented 10 months ago

Bug0 Triage Checklist (Main S/O)

melvin-bot[bot] commented 10 months ago

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

paultsimura commented 10 months ago

Proposal

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

The top report skeleton is not visible when offline.

What is the root cause of that problem?

This happens because we display the top skeleton based on this condition: https://github.com/Expensify/App/blob/772715011ce1431884bb499164faa36dcc8006e6/src/pages/home/report/ReportActionsView.js#L262

This value should get updated by calling the Report.getOlderActions here. But we have an early return when offline. This was made to avoid endless loop of the Report.getOlderActions call.

https://github.com/Expensify/App/blob/772715011ce1431884bb499164faa36dcc8006e6/src/pages/home/report/ReportActionsView.js#L179-L193

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

In ReportActionsView:

First, Move (and slightly modify) this code outside of loadOlderChats to the component level:

    const oldestReportAction = _.last(props.reportActions);
    const isLoadedTillBeginning = lodashGet(oldestReportAction, 'actionName', '') === CONST.REPORT.ACTIONS.TYPE.CREATED;

Second, modify the logic for displaying the top skeleton: show it also when offline & the history is not loaded until the beginning.

    isLoadingOlderReportActions={props.isLoadingOlderReportActions || (props.network.isOffline && !isLoadedTillBeginning)}

https://github.com/Expensify/App/blob/772715011ce1431884bb499164faa36dcc8006e6/src/pages/home/report/ReportActionsView.js#L262

What alternative solutions did you explore? (Optional)

s77rt commented 10 months ago

@paultsimura Thanks for the proposal. Your RCA makes sense but the solution does not look good to me. props.network.isOffline && !isLoadedTillBeginning will make isLoadingOlderReportActions evaluates to true even if we are not loading any report action.

s77rt commented 10 months ago

I see this is a regression from https://github.com/Expensify/App/pull/30658 and it's still within the regression period. In this case this should be fixed by the Contributor/Contributor+ @paultsimura / @getusha

getusha commented 10 months ago

I agree this looks like a regression from https://github.com/Expensify/App/pull/30658 @paultsimura could you address @s77rt's comment and raising a PR if possible?

paultsimura commented 10 months ago

Yes, I'm on it. However, @s77rt could you please elaborate a little on why is this bad?

props.network.isOffline && !isLoadedTillBeginning will make isLoadingOlderReportActions evaluates to true even if we are not loading any report action

If we are offline and not at the beginning of the conversation yet – this means we will eventually load the newer actions when online, doesn't it? We're not loading the older actions when offline anyway, so in my understanding, the skeleton here is used only to show the user that there are some more actions to load.

s77rt commented 10 months ago

@paultsimura The logic makes sense but just the way we are modifying the isLoadingOlderReportActions prop is counterintuitive. If isLoadingOlderReportActions is true then we must be indeed loading older report actions otherwise this prop won't be a reliable source of truth.

A slight adjustment is to move the logic to ListBoundaryLoader. This would keep the prop untouched and achieve same results.

paultsimura commented 10 months ago

Thanks @s77rt, this makes sense.

I would like to clarify the expected UI in the offline case: should we show the long skeleton, similar to when loading the older events, or the shorter one – like when loading the initial report actions?

Short https://github.com/Expensify/App/assets/12595293/cb8a23b7-051c-48ec-90a2-1171712fc7a9
Long https://github.com/Expensify/App/assets/12595293/2062a237-2575-4dd9-a9b4-d5674794f571

Also, I suppose it should be not animated when offline, similar to the LoadingInitialActions skeleton:

https://github.com/Expensify/App/blob/5d45f0f6c86e97d4ae58ac167b6c162a610b817c/src/pages/home/report/ListBoundaryLoader/ListBoundaryLoader.js#L48-L51

@shawnborton could you please share your upinion here?

shawnborton commented 10 months ago

Hmm shorter seems to make more sense to me, but cc @Expensify/design for thoughts in case they disagree.

Also, it looks like we are missing the animation on the skeleton lines above the preview cards. Any idea why those skeleton lines are not using the pulse/fade/gradient animation?

paultsimura commented 10 months ago

@shawnborton looks like it was made on purpose: we're disabling the animation when offline:

https://github.com/Expensify/App/blob/d521dd6783c382297e06a429701ae1936f808041/src/pages/home/report/ListBoundaryLoader/ListBoundaryLoader.js#L51

I believe this was made so that the user won't expect something new to be loaded while offline (the animation implies that something's happening).

If that's not the expected behaviour, I can remove this condition and the result will look like this:

https://github.com/Expensify/App/assets/12595293/a0e0bcfc-6dbc-448b-b3eb-c58ae1e3fde8

dannymcclain commented 10 months ago

Oh that's interesting about the animation—it makes total sense after you explain it, but I'm not sure anyone will connect those dots on their own. I don't have strong feelings about it though so I'll leave it to @shawnborton.

I'm also a fan of the short skeleton in this situation—it does it's job communicating the state so I don't think we need any more than that.

shawnborton commented 10 months ago

Hmm yeah, I see the point too. I think I'd rather just always have the subtle animation though, otherwise we get into a weird situation where we try to determine if the loading state should be animated or not based on connectivity, which might not be truly offline but could be flakey and cause some weird start/stop of the animation? So I lean towards just always having it.

paultsimura commented 10 months ago

Thanks y'all. The PR is ready: https://github.com/Expensify/App/pull/31492

melvin-bot[bot] commented 9 months ago

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

melvin-bot[bot] commented 9 months ago

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

If no regressions arise, payment will be issued on 2023-12-12. :confetti_ball:

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.

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

melvin-bot[bot] commented 9 months ago

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:

s77rt commented 9 months ago

Regression Test Proposal

  1. Open a chat that has a many messages
  2. Go offline
  3. Scroll to the top
  4. Verify that the skeleton loader is displayed
s77rt commented 9 months ago

@mallenexpensify Please assign @getusha and @paultsimura here since this is a part of https://github.com/Expensify/App/issues/30503

melvin-bot[bot] commented 9 months ago

❌ There was an error making the offer to @getusha for the Reviewer role. The BZ member will need to manually hire the contributor.

melvin-bot[bot] commented 9 months ago

📣 @getusha 🎉 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[bot] commented 9 months ago

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

getusha commented 9 months ago

@mallenexpensify we can close this as it was handled as a regression.