HomePhabricator
Diffusion Comm 6b3cd7e610f5

[lib] Fix useThreadSearchIndex performance issue

Description

[lib] Fix useThreadSearchIndex performance issue

Summary:
To enable search of chats by chat name and member name, we have in-memory JS search index. This search index needs to get updated when underlying Redux data changes, and it needs to ENS-resolve both member names and chat names.

I have 93 threads with ENS users. This resulted in a huge performance issue on my iOS device, since the thread search index was getting recalculated as each ENS name streamed in, one-by-one.

This diff makes it so we wait until all of the ENS fetches either resolve or time out before recalculcating the thread search index. This guaranteees that there will be at most 2 ThreadSearchIndex recalculations per update of the underlying Redux data (threadStore, userStore, and currentUserInfo).

Test Plan: I compiled a release build to my physical device and confirmed that the JS thread was no longer stalled after the splash screen dismissed

Reviewers: atul

Reviewed By: atul

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D8248

Details

Provenance
ashoatAuthored on Jun 19 2023, 12:16 PM
Reviewer
atul
Differential Revision
D8248: [lib] Fix useThreadSearchIndex performance issue
Parents
rCOMM5586b22448b8: [web] Introduce `EditUserAvatarMenu`
Branches
Unknown
Tags
Unknown