Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

MM-41271 : Don't render sidebar channels when collapsed #9732

Merged
merged 9 commits into from
Feb 10, 2022
Merged

Conversation

M-ZubairAhmed
Copy link
Member

@M-ZubairAhmed M-ZubairAhmed commented Feb 1, 2022

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

Removes collapsed sidebar menu from the dom on sidebar collapse and vise versa on sidebar expand

@M-ZubairAhmed M-ZubairAhmed added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels Feb 1, 2022
components/sidebar/sidebar_channel/sidebar_channel.tsx Outdated Show resolved Hide resolved
@@ -215,6 +248,10 @@ export default class SidebarChannel extends React.PureComponent<Props, State> {
);
}

if (!this.state.show) {
Copy link
Member

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.

Copy link
Member Author

@M-ZubairAhmed M-ZubairAhmed Feb 3, 2022

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

Copy link
Member

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

@esethna
Copy link
Contributor

esethna commented Feb 2, 2022

@M-ZubairAhmed @hmhealey Will this have a negative perceived performance impact when a user expands a channel category?

@hmhealey
Copy link
Member

hmhealey commented Feb 2, 2022

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.

@hmhealey hmhealey added the Setup Cloud Test Server Setup a test server using Mattermost Cloud label Feb 4, 2022

// On fully expanded
if (event.propertyName === 'height' && !this.isCollapsed(this.props)) {
this.setState({show: true});
Copy link
Member

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

Copy link
Member Author

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.

transition-timing-function: ease, ease, ease, ease-in, step-start;
&.expanded {
animation-direction: normal;
animation-duration: 0.4s;
Copy link
Member Author

@M-ZubairAhmed M-ZubairAhmed Feb 6, 2022

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

image

  • With same duration

image

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)

@M-ZubairAhmed M-ZubairAhmed added the 1: UX Review Requires review by a UX Designer label Feb 7, 2022
Copy link
Member

@jespino jespino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jgilliam17
Copy link
Contributor

@M-ZubairAhmed
Tested manually - no issues. Verified sidebar collapse and expand is working as expected. Also, new messages in collapsed categories are received as expected, as is the sorting to Unreads from collapsed categories.
E2E report has a failure that seems related to this PR MM-T2003 Can you please take a look? Thanks

@M-ZubairAhmed
Copy link
Member Author

@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

@jgilliam17
Copy link
Contributor

@M-ZubairAhmed Thanks for the latest report. Yes, everything looks good, no PR related failures. Good to merge.

@jgilliam17 jgilliam17 added 4: Reviews Complete All reviewers have approved the pull request and removed 3: QA Review Requires review by a QA tester Setup Cloud Test Server Setup a test server using Mattermost Cloud labels Feb 10, 2022
@mm-cloud-bot
Copy link

Test server destroyed

@M-ZubairAhmed M-ZubairAhmed merged commit 6333537 into master Feb 10, 2022
@M-ZubairAhmed M-ZubairAhmed deleted the MM-41271 branch February 10, 2022 14:10
@M-ZubairAhmed M-ZubairAhmed removed their assignment Feb 10, 2022
@amyblais
Copy link
Member

/cherry-pick release-6.3

@mattermod
Copy link
Contributor

Cherry pick is scheduled.

mattermost-build pushed a commit to mattermost-build/mattermost-webapp that referenced this pull request Feb 11, 2022
)

Collapsed menu in sidebar are removed from the DOM to improve performance.

(cherry picked from commit 6333537)
@mattermod mattermod added the CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone label Feb 11, 2022
hmhealey pushed a commit that referenced this pull request Feb 11, 2022
Collapsed menu in sidebar are removed from the DOM to improve performance.

(cherry picked from commit 6333537)

Co-authored-by: Md_ZubairAhmed <[email protected]>
@amyblais amyblais added Changelog/Done Required changelog entry has been written Docs/Not Needed Does not require documentation labels Feb 17, 2022
amyblais added a commit that referenced this pull request Feb 18, 2022
hmhealey pushed a commit that referenced this pull request Feb 18, 2022
@amyblais amyblais removed the CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone label Mar 1, 2022
@amyblais
Copy link
Member

amyblais commented Mar 7, 2022

/cherry-pick release-6.3

@mattermod
Copy link
Contributor

Cherry pick is scheduled.

mattermost-build pushed a commit to mattermost-build/mattermost-webapp that referenced this pull request Mar 7, 2022
)

Collapsed menu in sidebar are removed from the DOM to improve performance.

(cherry picked from commit 6333537)
@mattermod mattermod added the CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone label Mar 7, 2022
mattermod pushed a commit that referenced this pull request Mar 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4: Reviews Complete All reviewers have approved the pull request Changelog/Done Required changelog entry has been written CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone Docs/Not Needed Does not require documentation release-note
Projects
None yet
9 participants