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)
Mon, Apr 7, 11:14 PM
Unknown Object (File)
Sat, Mar 15, 2:21 AM
Unknown Object (File)
Sat, Mar 15, 2:21 AM
Unknown Object (File)
Sat, Mar 15, 2:21 AM
Unknown Object (File)
Sat, Mar 15, 2:21 AM
Unknown Object (File)
Feb 12 2025, 7:50 PM
Unknown Object (File)
Feb 12 2025, 7:50 PM
Unknown Object (File)
Feb 12 2025, 7:50 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable