Page MenuHomePhabricator

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

Authored by rohan on Dec 12 2023, 11:04 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 9, 5:22 PM
Unknown Object (File)
Fri, Nov 8, 10:02 PM
Unknown Object (File)
Fri, Nov 8, 7:18 PM
Unknown Object (File)
Fri, Nov 8, 7:18 PM
Unknown Object (File)
Oct 4 2024, 9:22 AM
Unknown Object (File)
Sep 11 2024, 3:28 AM
Unknown Object (File)
Sep 11 2024, 3:28 AM
Unknown Object (File)
Sep 11 2024, 3:28 AM
Subscribers

Details

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:

Diff Detail

Repository
rCOMM Comm
Branch
search_users
Lint
No Lint Coverage
Unit
No Test Coverage