HomePhabricator
Diffusion Comm c7cbe918dad2

[lib] Prevent the influx of SEARCH_USERS_[STARTED/SUCCESS] actions

Tags
None
Referenced Files
F930203: After.mov
Dec 13 2023, 7:19 PM
File Not Attached
F930181: before.mov
Dec 13 2023, 7:19 PM
File Not Attached
Subscribers

Description

[lib] Prevent the influx of SEARCH_USERS_[STARTED/SUCCESS] actions

Summary:
In useSearchUsers we call the searchUsers endpoint every time the hook is called. We don't have a need for dispatching the SEARCH_USERS action when the provided search text is empty, because we don't even call the endpoint in that case. In that case, we just set the server search results to an empty array.

Addresses [[ https://linear.app/comm/issue/ENG-6046/saw-lots-of-search-users-[startedsuccess]-in-redux-devtools#comment-5209e0bd | ENG-6046 ]]

Test Plan:
I repro'd in the same way @atul did in the original Linear task - by having keyserver restart due to code changes (in this case, just by adding a console.log() in keyserver.js and watching the dev tools)

Before:

After:

Reviewers: atul, michal, ashoat

Reviewed By: ashoat

Subscribers: ashoat, tomek, atul

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

Details

Provenance
rohanAuthored on Dec 12 2023, 11:00 AM
Reviewer
ashoat
Differential Revision
D10312: [lib] Prevent the influx of SEARCH_USERS_[STARTED/SUCCESS] actions
Parents
rCOMM1b12b933f5cc: [lib] Simplify `getRelativeMemberInfos`
Branches
Unknown
Tags
Unknown