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.03k stars 2.54k forks source link

Fix canShowHeader logic #42332

Closed janicduplessis closed 4 days ago

janicduplessis commented 2 weeks ago

Details

I noticed that the loading indicator for loading new messages is not displayed.

I traced it back to this commit which refactored the logic to a variable, but incorrectly.

It changed

if (!isOffline && !hasHeaderRendered.current) {

to

const canShowHeader = !isOffline && !hasHeaderRendered.current;
...
if (!canShowHeader) {

The correct change is:

const canShowHeader = isOffline || hasHeaderRendered.current;
...
if (!canShowHeader) {

When testing on iOS I also noticed the scrollingVerticalOffset check was preventing the loading indicator from showing some times. I don't see why it would be needed and didn't seem to introduce any problem when testing loading other chats.

After this the header now shows correctly on 2nd render as the code was meant to do.

Before

https://github.com/Expensify/App/assets/2677334/e144e1f0-bc14-420e-a267-68234b468ed5

After

https://github.com/Expensify/App/assets/2677334/b704385e-891a-4896-a45f-427b417c2da4

Fixed Issues

$ https://github.com/Expensify/App/issues/42331 PROPOSAL:

Tests

Offline tests

QA Steps

Steps to test comment linking:

  1. Go in a long chat and scroll to an old message
  2. Right click and "Copy link"
  3. Go in another chat and paste the link
  4. Clear the cache (Account Settings -> Troubleshoot -> Clear cache and restart)
  5. Go back to the chat with the link and click it
  6. You will be in the middle of a chat and can test loading older / newer messages

PR Author Checklist

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native https://github.com/Expensify/App/assets/2677334/1e10e14c-bbee-4d35-b9f6-c42a6b5b16cd
iOS: mWeb Safari
MacOS: Chrome / Safari https://github.com/Expensify/App/assets/2677334/b704385e-891a-4896-a45f-427b417c2da4
MacOS: Desktop
melvin-bot[bot] commented 2 weeks ago

@jayeshmangwani Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

janicduplessis commented 2 weeks ago

@perunt Would you be able to confirm this change is ok since you wrote that code initially?

janicduplessis commented 2 weeks ago

I also noticed on iOS there seems to be an issue where newer messages don't load initially unless you scroll back up a little, you can see in the video in the screenshots section. I will investigate that in a follow up.

jayeshmangwani commented 1 week ago

@janicduplessis Is this a follow-up PR of any other PR?

janicduplessis commented 1 week ago

I found the issue while working on https://github.com/Expensify/App/pull/40610, but it is not directly related.

jayeshmangwani commented 1 week ago

@rojiphil This PR is somewhat related to this PR https://github.com/Expensify/App/pull/40610, Would you complete the checklist here, or should I start the review?

rojiphil commented 1 week ago

I traced it back to this commit which refactored the logic to a variable, but incorrectly.

@janicduplessis From the PR description it looks like the root cause lies elsewhere and is unrelated to PR #40610.

rojiphil commented 1 week ago

Would you complete the checklist here, or should I start the review?

@jayeshmangwani Please go ahead if you are available here. I am not sure if I can get to this in the next 2-3 days.

mountiny commented 1 week ago

@jayeshmangwani Please go ahead with this PR

jayeshmangwani commented 1 week ago

On it...

jayeshmangwani commented 1 week ago

@janicduplessis Is there any way to test the Android loader? I have tried with the Steps in the Tests and deep link, but not able to see the Loader for Android native

https://github.com/Expensify/App/assets/35371050/f65307d6-b2ec-4893-a6d6-0a25ab091151

jayeshmangwani commented 1 week ago

Is there any way to test the Android loader? I have tried with the Steps in the Tests and deep link, but not able to see the Loader for Android native

@janicduplessis

mountiny commented 1 week ago

Running a build @janicduplessis are you able to help @jayeshmangwani please?

github-actions[bot] commented 1 week ago
:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube: Android :robot: iOS :apple:
https://ad-hoc-expensify-cash.s3.amazonaws.com/android/42332/index.html https://ad-hoc-expensify-cash.s3.amazonaws.com/ios/42332/index.html
Android iOS
Desktop :computer: Web :spider_web:
https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/42332/NewExpensify.dmg https://42332.pr-testing.expensify.com
Desktop Web

:eyes: View the workflow run that generated this build :eyes:

janicduplessis commented 1 week ago

@jayeshmangwani The seems to be another issue on mobile where the newer messages are not loading unless you scroll up some. Does it work if you try to scroll up for about 1-2 screens of height then scroll back down?

janicduplessis commented 1 week ago

I will try to look at that issue next.

jayeshmangwani commented 1 week ago

Does it work if you try to scroll up for about 1-2 screens of height then scroll back down?

Now, After trying several times, I am able to show the loader a few times

jayeshmangwani commented 1 week ago

Reviewer Checklist

Screenshots/Videos

Android: Native https://github.com/Expensify/App/assets/35371050/01394c15-8916-42ae-8790-71b72f339f7e
Android: mWeb Chrome https://github.com/Expensify/App/assets/35371050/18c41f9c-0446-4c62-8d05-17fcdacaf910
iOS: Native https://github.com/Expensify/App/assets/35371050/62a708ed-a772-4939-ad9f-33eff72875d1
iOS: mWeb Safari https://github.com/Expensify/App/assets/35371050/61694ef8-ac82-42dd-a8df-b631070f73f7
MacOS: Chrome / Safari https://github.com/Expensify/App/assets/35371050/dc1e74cc-0890-4be9-92c4-c22af241d981
MacOS: Desktop https://github.com/Expensify/App/assets/35371050/2577de62-3883-4dd6-896b-c02e0677e35d
jayeshmangwani commented 1 week ago

Code changes looks good, and Tests Well.

NAB: Videos are missing for some platforms

OSBotify commented 4 days ago

:hand: This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

OSBotify commented 3 days ago

🚀 Deployed to staging by https://github.com/mountiny in version: 1.4.77-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
OSBotify commented 2 days ago

🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.77-11 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
OSBotify commented 2 days ago

🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.77-11 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅