Skip to content

[HIGH] Make the Search Sidebar transition relatively smooth on slower devices #31842

Closed

Description

@muttmuure

Problem

When user navigates back from Search Sidebar there’s a noticeable delay and lag in closing the Search Sidebar. It mainly arises from withNavigationFocus HOC as it re-renders the BaseOptionSelector tree including OptionsList . Adding a memo to OptionsList doesn’t help as it’s parent gets re-rendered due to the withNavigationFocus HOC.
Also, we notice that due to isFocused state value in ActionItemView the ReportActionsList re-renders which also adds the overhead to the rendering cycle as it recreates the instances of recordTimeToMeasureItemLayout and loadOlderChats which are passed as props to ReportActionsList

Solution

We can remove the withNavigationFocus HOC and add navigation listeners(focus, blur) in BaseOptionSelector and memoize OptionsListto not re-render when state is set in it’s parent. We can avoid recreating instances of recordTimeToMeasureItemLayout and loadOlderChats by wrapping them in useCallbacks and memorizing ReportActionsList.

Before on 6x CPU throttle:

See profile-ranked-before
See profile-timeline-before
See recording-before

After on 6x CPU throttle:

See profile-ranked-after
See profile-timeline-after
See recording-after

The results looks impressive as we are able to save more than 700ms for the commit that happens when we close the Search sidebar.

Activity

  1. muttmuure commented on Nov 24, 2023

    @muttmuure
    ContributorAuthor

    @hurali97's PR is here! #31354

  2. melvin-bot commented on Feb 9, 2024

    @melvin-bot

    @muttmuure, this Monthly task hasn't been acted upon in 6 weeks; closing.

    If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions