Page MenuHomePhabricator

[native] Memoize construction of `sidebars` in `ChatThreadListItem`
ClosedPublic

Authored by atul on Sep 7 2023, 10:51 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 2, 3:52 PM
Unknown Object (File)
Sun, Aug 25, 12:10 AM
Unknown Object (File)
Jul 22 2024, 10:16 PM
Unknown Object (File)
Jul 15 2024, 5:09 PM
Unknown Object (File)
Jul 15 2024, 5:09 PM
Unknown Object (File)
Jul 15 2024, 5:09 PM
Unknown Object (File)
Jul 15 2024, 5:09 PM
Unknown Object (File)
Jul 15 2024, 5:04 PM
Subscribers

Details

Summary

This was getting re-rendered every time which recursively led to ChatThreadListSidebar, etc getting re-rendered every time. This change means ChatThreadListSidebar will render only once (unless something relevant changes).

Before:

014d54.png (1×2 px, 648 KB)

After:

8cb34d.png (1×2 px, 892 KB)


Depends on D9100

Test Plan

Things continue to work as expected.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul published this revision for review.Sep 7 2023, 10:55 AM
tomek added inline comments.
native/chat/chat-thread-list-sidebar.react.js
69–72 ↗(On Diff #30851)

Maybe we can wrap SidebarItem with React.memo?

This revision is now accepted and ready to land.Sep 8 2023, 2:26 AM
native/chat/chat-thread-list-sidebar.react.js
69–72 ↗(On Diff #30851)

7cd38c.png (828×1 px, 113 KB)

SidebarItem was memoized in previous diff

This revision was landed with ongoing or failed builds.Sep 8 2023, 3:05 PM
This revision was automatically updated to reflect the committed changes.
native/chat/chat-thread-list-sidebar.react.js
69–72 ↗(On Diff #30851)

If it is memoized, then what's the benefit of wrapping it with useMemo?