Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lib] Avoid creation new ChatThreadItem unnecessarily in getSearchRes…
…ultsForEmptySearchText Summary: In the process of [investigating ENG-5674](https://linear.app/comm/issue/ENG-5674/improve-performance-of-useflattenedchatlistdata#comment-df182f4b), 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 Reviewers: tomek, angelika Reviewed By: tomek Differential Revision: https://phab.comm.dev/D13903
- Loading branch information