-
Notifications
You must be signed in to change notification settings - Fork 3k
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
New skeleton loader for LHN #14456
New skeleton loader for LHN #14456
Conversation
@roryabraham @aimane-chnaif One of you needs to 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] |
Let me know if you need a new svg for that. We recently made it so that the space between all avatars and messages as 12px. So we might just need to update that svg everywhere, for both LHN and messages. |
Yep, you are right, we need to adjust 4px closer to the avatar. Thanks for noticing that. Updated the code. |
bug.mov@bernhardoj there are many weird issues in this video
Test step:
I think all of these are related to navigation code. |
@aimane-chnaif Ah, I see. I think we should disable the FAB while loading, the same thing we do with search and setting button. But the search is still accessible from the keyboard shortcuts. At first, I thought that we need to disable the shortcut too, but then I look at staging, we can open the search page while the full screen loading showing and I think the issue you see is the same which is the list is empty. So, I am not sure about this one. Should we also disable the shortcut? |
@bernhardoj I think disabling other pages is a workaround. Can we fix this in navigation level? |
I will try to find a safer way to update the params. |
I have updated the
|
I'd like to get opinion from @shawnborton @roryabraham regarding user interaction on FAB menu before loading data
|
We've been having a similar conversation about how to handle the chat composer input when loading chats (cc @JmillsExpensify) and I think we landed with deciding that we shouldn't block the user interacting with the FAB or even navigating to the type of object they want to create from the FAB. |
Maybe we can show a loading indicator while loading the data like the page here Details Pageand update the list state when the data is ready. |
@bernhardoj we opened discussion here so you can 👁️ |
I have removed the disable from the button. But I just tested that we can press New Workspace from the FAB menu while loading the initial data and it will lead to duplicate workspaces with the same name. Is this also out of scope and need to be handled on a seperate issue? 329278.t.mp4 |
I don't think we should allow those kinds of issues. Something like search list empty issues can be out of scope since they're already happening on production but those issues are critical and kind of regression. |
So, I was trying to find a way for that FAB new workspace. I realize that when we open the app, App.openApp() will be called. It will load all the initial data and set IS_LOADING_REPORT_DATA while loading it. We can use this to hide the new workspace menu until the loading is finished. diff --git a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js
index 6fe0447ef..4520dda29 100644
--- a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js
+++ b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js
@@ -207,7 +207,7 @@ class FloatingActionButtonAndPopover extends React.Component {
onSelected: () => Navigation.navigate(ROUTES.IOU_BILL),
},
] : []),
- ...(!Policy.hasActiveFreePolicy(this.props.allPolicies) ? [
+ ...(!this.props.isLoading && !Policy.hasActiveFreePolicy(this.props.allPolicies) ? [
{
icon: Expensicons.NewWorkspace,
iconWidth: 46,
@@ -247,5 +247,8 @@ export default compose(
betas: {
key: ONYXKEYS.BETAS,
},
+ isLoading: {
+ key: ONYXKEYS.IS_LOADING_REPORT_DATA,
+ },
}),
)(FloatingActionButtonAndPopover); With the IS_LOADING_REPORT_DATA key, this makes me think that maybe we can also use this to replace the emptiness condition of report and personal details. For example, replace this with the IS_LOADING_REPORT_DATA onyx key. But the problem with this onyx key is that it will also be true when ReconnectApp is called. On Android (the device I tested), when we come from background, ReconnectApp will be called. This will make the skeleton will show again. So, maybe we can create a new key that is only set to true on OpenApp (like IS_LOADING_INITIAL_REPORT_DATA). I am not sure whether this is the best approach or not because our current code uses the emptiness state of report/personal details and not using the IS_LOADING_REPORT_DATA. Sorry if it's not clear. What do you think? @aimane-chnaif @roryabraham |
@roryabraham kindly bump for re-review |
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.
Only one very minor blocker in boolean variable name. Other than that I think this code looks good, but I'm a bit confused about why some of the changes were needed.
@roryabraham bump again for review! |
@bernhardoj please fix pull from |
Fixed. I also updated the |
@bernhardoj please fix conflict |
Fixed. I also have retested the steps from this PR #15994 (which causes the conflict) and still works well. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Cool, finally 🥳. Thanks for the review @aimane-chnaif @roryabraham @shawnborton. I guess the next step is to follow up on some issues here #14456 (comment). Here is the list of issues that I think we need to follow up:
|
Minor console warning: (happens after login) @bernhardoj can you investigate this? |
Here's discussion: https://expensify.slack.com/archives/C01GTK53T8Q/p1679665614690159 (for reference) |
🚀 Deployed to staging by https://github.com/roryabraham in version: 1.2.89-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.2.89-0 🚀
|
this.generateSkeletonViewItems(numItems); | ||
}} | ||
> | ||
<View>{this.state.skeletonViewItems}</View> |
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.
Hi @bernhardoj, coming from #33163, Is there any specific reason that we didn't render SkeletonViewContentLoader
directly via an array map function
here, but pre-calculate and stored in this.state.skeletonViewItems
in onLayout
callback?
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.
Changed it based on this suggestion. I think it's just for optimization.
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.
Thanks @bernhardoj
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.
Hi @roryabraham, do you mind sharing the reason why you prefer to generate skeletonViewItems
and store it in the component's state? In a first glance, I think it's because of optimization as @bernhardoj said above but I usually see the pattern where we generate a list/array of items (with a key
) in component render function, leaving the rendering optimization part for React. Thanks
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.
^ just in case you missed this message @roryabraham
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.
Answered here
Details
When we sign in to the app, a full screen loading indicator will be shown while loading the app data. Now, we want to show a skeleton instead while loading the required data.
Tagging @shawnborton for the design review.
Fixed Issues
$ #12698
PROPOSAL: #12698 (comment)
Tests
Offline tests
(I don't think we can test it when we are fully offline)
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)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.Screenshots/Videos
Web
Screen.Recording.2023-01-20.at.21.08.55.mov
Mobile Web - Chrome
329155.t.mp4
Mobile Web - Safari
Untitled.mov
Desktop
Screen.Recording.2023-01-20.at.21.46.22.mov
iOS
Screen.Recording.2023-01-20.at.21.20.17.mov
Android
329156.t.mp4