Page MenuHomePhabricator

[native] Memoize `SwipeableThread`
ClosedPublic

Authored by atul on Sep 7 2023, 10:05 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 2, 3:52 PM
Unknown Object (File)
Tue, Aug 27, 1:18 AM
Unknown Object (File)
Mon, Aug 26, 7:17 PM
Unknown Object (File)
Mon, Aug 26, 7:15 PM
Unknown Object (File)
Mon, Aug 26, 4:29 PM
Unknown Object (File)
Sat, Aug 24, 8:59 PM
Unknown Object (File)
Sat, Aug 24, 8:59 PM
Unknown Object (File)
Sat, Aug 24, 8:59 PM
Subscribers

Details

Summary

The real performance gains will come from adding memoization to ChatThreadListItem and ChatThreadListSidebar, but this is a prerequisite for those optimizations to make a difference.


Depends on D9099

Test Plan

Continue to look and behave as expected.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul requested review of this revision.Sep 7 2023, 10:23 AM
tomek added inline comments.
native/chat/swipeable-thread.react.js
82–93 ↗(On Diff #30848)

Creating a memo that depends on children doesn't always work. The problem appears when SwipeableThread has more than one child

<SwipeableThread>
  <View .../>
</SwipeableThread>

vs

<SwipeableThread>
  <View .../>
  <View .../>
</SwipeableThread>

In the second case, props.children is an array that is created on every render, which means that this memo will be recomputed every time. Not sure if it can be fixed from this component, but we can check the usages of SwipeableThread.

This revision is now accepted and ready to land.Sep 8 2023, 2:22 AM
native/chat/swipeable-thread.react.js
82–93 ↗(On Diff #30848)

I think we should be fine based on

a0eadb.png (1×2 px, 208 KB)

This revision was automatically updated to reflect the committed changes.