Page MenuHomePhabricator

[native] Pull static fns out of `ChatThreadList` to `ChatThreadListUtils`
ClosedPublic

Authored by atul on Sep 11 2023, 3:21 PM.
Tags
None
Referenced Files
F3387004: D9135.diff
Fri, Nov 29, 7:12 AM
Unknown Object (File)
Wed, Nov 20, 4:01 PM
Unknown Object (File)
Tue, Nov 12, 11:23 AM
Unknown Object (File)
Mon, Nov 11, 4:20 AM
Unknown Object (File)
Oct 27 2024, 5:43 PM
Unknown Object (File)
Oct 19 2024, 2:14 AM
Unknown Object (File)
Oct 19 2024, 2:14 AM
Unknown Object (File)
Oct 19 2024, 2:14 AM
Subscribers

Details

Summary

There are a handful of static functions in the ChatThreadList component. Figured I'd move these out to a separate utils file.

(I initially had a huge diff that converted ChatThreadList to a functional component and added various memoizations. However, I realized that diff would be pretty difficult to review so I'm breaking down the refactor into hopefully easier to review pieces.)

This diff is just one step in the process of converting ChatThreadList into a functional component. When this work is done, we will be able to avoid a lot of re-rendering and hopefully improve performance quite a bit.

In subsequent diffs will

  1. Lift up "search-related" JSX
  2. etc.. continue turning ChatThreadList into a functional component so we can more precisely memoize things, particularly ChatThreadListItems.

Depends on D9134

Test Plan

Search experience continues to work as expected. Can search for users/threads/etc. as before.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul published this revision for review.Sep 11 2023, 3:22 PM
atul added inline comments.
native/chat/chat-thread-list-utils.js
34–38 ↗(On Diff #30943)

This was originally

let height = chatThreadListItemHeight;
height += item.sidebars.length * sidebarHeight;
if (item.sidebars.length > 0) {
  height += spacerHeight;
}
return height;

Took some liberties in rewriting to my personal preference, but can totally revert back

This revision is now accepted and ready to land.Sep 12 2023, 9:34 PM