-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix: Chat - Skeleton placeholder flickers when opening chat with IOU in offline mode #30658
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 |
const isFocused = useIsFocused(); | ||
const reportID = props.report.reportID; | ||
|
||
/** | ||
* @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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 🚀
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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