Page MenuHomePhabricator

[lib] Avoid creation new ChatThreadItem unnecessarily in getSearchResultsForEmptySearchText
ClosedPublic

Authored by ashoat on Mon, Nov 11, 3:12 PM.
Tags
None
Referenced Files
F3351467: D13903.diff
Sat, Nov 23, 1:47 AM
Unknown Object (File)
Wed, Nov 20, 3:36 PM
Unknown Object (File)
Wed, Nov 20, 8:19 AM
Unknown Object (File)
Tue, Nov 19, 9:24 PM
Unknown Object (File)
Tue, Nov 19, 3:01 PM
Unknown Object (File)
Tue, Nov 19, 12:30 AM
Unknown Object (File)
Mon, Nov 18, 8:57 PM
Unknown Object (File)
Mon, Nov 18, 10:05 AM
Subscribers
None

Details

Summary

In the process of investigating ENG-5674, I noticed an issue here. I had implemented a caching layer for useFlattenedChatListData so that it would avoid creating a new ChatThreadItem when the underlying data for it had not changed in Redux. But the code here was recreating the ChatThreadItem on every render anyways, forcing a bunch of components to rerender (and values to be recalculated) unnecessarily.

While I don't have a good long-term solution for ENG-5674 (and I probably won't prioritize it anytime soon), I think it's always best to avoid constructing new objects when the existing object suffices.

Test Plan

Flow

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable