fix: Chat - Skeleton placeholder flickers when opening chat with IOU in offline mode#30658
Conversation
# Conflicts: # src/pages/home/report/ReportActionsView.js
|
@getusha the PR's ready, the only thing I'm concerned about is that the skeleton UI is not visible on the first render of the IOU report. It appears only if we re-render it (e.g. go to transaction view and back). But this seems to have been done intentionally (please see the comment): App/src/pages/home/report/ReportActionsList.js Lines 371 to 376 in 36495e6 |
@paultsimura is this happening on |
| * @returns {Boolean} | ||
| */ | ||
| const isReportFullyVisible = useMemo(() => getIsReportFullyVisible(isFocused), [isFocused]); | ||
| const isFullHistoryFetched = useMemo(() => _.last(props.reportActions).actionName === CONST.REPORT.ACTIONS.TYPE.CREATED, [props.reportActions]); |
There was a problem hiding this comment.
I don't think _.last(props.reportActions).actionName === CONST.REPORT.ACTIONS.TYPE.CREATED is expensive enough to be using useMemo. This is just accessing the lsat member of an array which should be very fast.
|
@ospfranco @fedirjh could you please help us understand what use case was this piece of code initially fixing, and if it might be safe to remove now since we've separated the actions loading variables to App/src/pages/home/report/ReportActionsList.js Lines 371 to 376 in 36495e6 |
|
@getusha I think I figured it out. We use the App/src/pages/home/report/ReportActionsList.js Lines 371 to 376 in c8e7ee5 But as we are offline, the actual request will not be sent to the BE, and we are safe to show the skeleton permanently until we are back online. So I've modified the logic with these references. I also removed the originally proposed change to Ready for your re-review. |
|
@paultsimura could you check why Jest Unit Tests are failing? |
@getusha I believe it was some flaky test. Resolved by itself after I merged |
Reviewer Checklist
Screenshots/VideosAndroid: NativeFILE.2023-11-06.17.46.51.mp4Android: mWeb ChromeScreen.Recording.2023-11-07.at.8.00.02.PM.moviOS: NativeScreen.Recording.2023-11-07.at.2.41.43.PM.moviOS: mWeb SafariScreen.Recording.2023-11-07.at.4.20.50.PM.movMacOS: Chrome / SafariScreen.Recording.2023-11-07.at.4.13.27.PM.movMacOS: DesktopScreen.Recording.2023-11-07.at.8.05.58.PM.mov |
|
@paultsimura noticed this, still looks glitchy but with bigger interval than the previous one. can you check it? Screen.Recording.2023-11-03.at.11.57.05.PM.mov |
|
@getusha Could you please share a little context on how to reproduce this? I see on your recording, this is happening on a regular report screen, not the IOU as it was in the issue. I'll try to reproduce, but any details would be useful 🙏🏼 |
|
@paultsimura i just scrolled up, and this is happening. i think we should also fix this since it is the same issue at a different place. |
Sure, I'm on it. Thanks for catching this bug |
|
@getusha I couldn't reproduce it on either iOS or Android. And also for the clarity of the experiment – please check if the same flickering is happening on the IOU Report 🙏 |
|
@paultsimura still not able to reproduce? i thought i saw a comment saying u're able to reproduce it. |
|
@getusha I tried on web - checked staging by mistake, and commented "reproduced". Only after that I noticed that it was staging, so I removed that comment. Still not able to reproduce on my branch. |
getusha
left a comment
There was a problem hiding this comment.
Looks good and tests went well.
|
@paultsimura Looks like we have a conflict. |
# Conflicts: # src/pages/home/report/ReportActionsView.js
|
@getusha thanks, resolved. Also made a tiny change in the last commit. |
|
Why did we change from using the hook Are you sure that this won't cause issues? Are we going to need to retest this? |
|
@aldo-expensify the I just noticed it when merging the latest |
|
I see now, thanks for explaining! |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/aldo-expensify in version: 1.3.96-6 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.96-15 🚀
|
|
🚀 Deployed to staging by https://github.com/aldo-expensify in version: 1.3.98-0 🚀
|
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.98-5 🚀
|
| // Only fetch more if we are not already fetching so that we don't initiate duplicate requests. | ||
| if (props.isLoadingOlderReportActions) { | ||
| // Only fetch more if we are neither already fetching (so that we don't initiate duplicate requests) nor offline. | ||
| if (props.network.isOffline || props.isLoadingOlderReportActions) { |
There was a problem hiding this comment.
This caused a regression #31367. Previously even if we were offline Report.getOlderActions would be still called and sets isLoadingOlderReportActions to true which in turns show the skeleton view. Now with this early return we prevented the skeleton view from showing up in this case.
Details
Fix the flickering of the IOU report when offline
Fixed Issues
$ #30503
PROPOSAL: #30503 (comment)
Tests
Same as QA.
Offline tests
Same as QA.
QA Steps
Precondition: There must be a user with an existing unpaid IOU.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android-compressed.mp4
Android: mWeb Chrome
chrome.mp4
iOS: Native
iOS.mp4
iOS: mWeb Safari
safari.mp4
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mp4