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
F3328843: D13903.id45749.diff
Wed, Nov 20, 3:36 PM
F3327134: D13903.id.diff
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
Unknown Object (File)
Sun, Nov 17, 12:47 PM
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
Branch
ashoat/globalsearch
Lint
No Lint Coverage
Unit
No Test Coverage