HomePhabricator
Diffusion Comm 085cb4bdcf4c

[web] Memoize `LeftLayoutAside` component

Description

[web] Memoize LeftLayoutAside component

Summary:
Wrap LeftLayoutAside in React.memo hook to avoid unnecessary re-rendering - e.g. when opening modals.

While working on Sidebars Modal and analysing performance, I noticed that LeftLayoutAside is not memoized and re-renders every time when parent component changes (e.g. while opening modals).
As it doesn't receive any props and uses only hooks to read navigation state, it doesn't need to be re-rendered each time when parent re-renders and it can improve performance a bit.

Test Plan: Run web app and made actions on modals to confirm it doesn't re-render in React Profiler after the change. Confirmed that the component works as before.

Reviewers: palys-swm, atul

Reviewed By: atul

Subscribers: ashoat, Adrian, yayabosh

Differential Revision: https://phab.comm.dev/D4551

Details

Provenance
jacekAuthored on Jul 20 2022, 6:52 AM
Reviewer
atul
Differential Revision
D4551: [web] Memoize `LeftLayoutAside` component
Parents
rCOMM8ab5594be591: Retrieve messages from temporary message storage in AppDelegate
Branches
Unknown
Tags
Unknown