-
Notifications
You must be signed in to change notification settings - Fork 2.7k
MM-41271 : Don't render sidebar channels when collapsed #9732
Conversation
@@ -215,6 +248,10 @@ export default class SidebarChannel extends React.PureComponent<Props, State> { | |||
); | |||
} | |||
|
|||
if (!this.state.show) { |
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.
Could you move this up closer to the top of the render? I know it won't make much of a difference to skip the whole setup of wrappedComponent
, but it's nice to return early when rendering null doesn't depend on any of the other work done by this function.
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.
There were few UI gliches when we werent rendering the draggable components so i moved this check above https://github.com/mattermost/mattermost-webapp/pull/9732/files#diff-4c9f89f66f73c204771dc4e66a58fb0c67b346703ea3753e8c3337a99e9f9540R175
I have updated the screen grab to show this
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.
Okay, that should be fine. I assume the heaviest part of those extra channels in the sidebar is the actual channelComponent
, so that should still be a performance improvement. I will have to update my queries I've been asking people to run since they'll still count those empty draggable items
@M-ZubairAhmed @hmhealey Will this have a negative perceived performance impact when a user expands a channel category? |
No, it shouldn't. We expect this to be a decent performance improvement for anyone with a lot of channels in their sidebar who keeps any categories collapsed though. |
a6e77c3
to
60b1d06
Compare
08b318a
to
3cf656e
Compare
|
||
// On fully expanded | ||
if (event.propertyName === 'height' && !this.isCollapsed(this.props)) { | ||
this.setState({show: true}); |
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 actually needs to be set at the start of transition so that the channel is shown as it expands. Right now, it renders nothing while the channel is expanding until it just pops in
Screen.Recording.2022-02-04.at.11.00.21.AM.mov
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.
Yes i fixed it. I changed my approach to using the css 3 animation. This was done because
- browser can optimize for animation steps
- animation start and end event listeners are typed correctly in react types, where as transition start doesn't exist in react dom types.
test update
165db1f
to
1d6ce8f
Compare
1d6ce8f
to
6828e2e
Compare
sass/layout/_sidebar-left.scss
Outdated
transition-timing-function: ease, ease, ease, ease-in, step-start; | ||
&.expanded { | ||
animation-direction: normal; | ||
animation-duration: 0.4s; |
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.
If you notice transition duration and animation duration are different: 0.15 and 0.18 respectively. Take a look at the fps comparison with both being dissimilar and being same.
- With dissimilar duration
- With same duration
The one with the same duration shows few frames were dropped at the starting of the menu collapsing. This reduced in frame rate resulted in choppy transition. On the other hand the one with different duration shows no frame drop resulting in near 60 fps. Height collapsing is a layout shift operation which requires more effort than opacity since browser has to paint change in height in every step. Change in duration gives browser enough room to perform the transition. (performance profiles available in g drive)
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.
LGTM
@M-ZubairAhmed |
@jgilliam17 it seems like that is the old report, i have fixed all the related e2es for this pr, here is the latest report https://automation-dashboard.vercel.app/cycles/1455f4cf-3731-4819-af4d-4e986cfca0a4 |
@M-ZubairAhmed Thanks for the latest report. Yes, everything looks good, no PR related failures. Good to merge. |
Test server destroyed |
/cherry-pick release-6.3 |
Cherry pick is scheduled. |
) Collapsed menu in sidebar are removed from the DOM to improve performance. (cherry picked from commit 6333537)
Collapsed menu in sidebar are removed from the DOM to improve performance. (cherry picked from commit 6333537) Co-authored-by: Md_ZubairAhmed <[email protected]>
/cherry-pick release-6.3 |
Cherry pick is scheduled. |
) Collapsed menu in sidebar are removed from the DOM to improve performance. (cherry picked from commit 6333537)
Summary
Collapsed menu in sidebar are removed from the DOM to improve performance.
Ticket Link
https://mattermost.atlassian.net/browse/MM-41271
Related Pull Requests
None
Screenshots
Screen.Recording.2022-02-03.at.5.59.06.pm.mov
Release Note