Page MenuHomePhabricator

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

Authored by atul on Sep 7 2023, 10:51 AM.
Tags
None
Referenced Files
F3724537: D9102.id30882.diff
Wed, Jan 8, 5:43 PM
F3724536: D9102.id30881.diff
Wed, Jan 8, 5:43 PM
F3724535: D9102.id30851.diff
Wed, Jan 8, 5:43 PM
Unknown Object (File)
Mon, Jan 6, 5:28 PM
Unknown Object (File)
Sun, Dec 29, 11:52 AM
Unknown Object (File)
Fri, Dec 20, 3:12 AM
Unknown Object (File)
Dec 3 2024, 2:18 AM
Unknown Object (File)
Dec 3 2024, 2:04 AM
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
Branch
arcpatch-D9102 (branched from master)
Lint
No Lint Coverage
Unit
No Test Coverage

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?