Page MenuHomePhabricator

[lib] Avoid creation new ChatThreadItem unnecessarily in getSearchResultsForEmptySearchText
ClosedPublic

Authored by ashoat on Nov 11 2024, 3:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 13, 11:17 PM
Unknown Object (File)
Fri, Dec 13, 11:17 PM
Unknown Object (File)
Fri, Dec 13, 11:15 PM
Unknown Object (File)
Fri, Dec 13, 11:09 PM
Unknown Object (File)
Mon, Dec 9, 6:53 AM
Unknown Object (File)
Fri, Dec 6, 8:22 AM
Unknown Object (File)
Sat, Nov 30, 1:53 AM
Unknown Object (File)
Wed, Nov 27, 12:04 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