Page MenuHomePhabricator

[web] Update UserList to call useUserSearchIndex
ClosedPublic

Authored by rohan on Dec 8 2023, 5:31 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 7 2024, 8:31 AM
Unknown Object (File)
Mar 7 2024, 7:48 AM
Unknown Object (File)
Mar 7 2024, 7:07 AM
Unknown Object (File)
Mar 7 2024, 6:53 AM
Unknown Object (File)
Mar 7 2024, 6:00 AM
Unknown Object (File)
Mar 7 2024, 5:59 AM
Unknown Object (File)
Mar 7 2024, 5:02 AM
Unknown Object (File)
Dec 30 2023, 1:19 AM
Subscribers

Details

Summary

There are several search experiences in the app that do not use get/usePotentialMemberItems. This means we need to update them individually, so I'm separating out diffs to do exactly this to make it easy for reviewers. [[ https://linear.app/comm/issue/ENG-6019/[after-landing]-try-to-update-remaining-search-experiences-to-use | ENG-6019 ]] tracks attempting to update these search experiences to use usePotentialMemberItems. Each diff will affect one file ideally.

This diff affects UserList.

This component is used when:

  • viewing friend list on web
  • viewing block list on web

Addresses ENG-5434

Depends on D10250

Test Plan

Please see the video below where I view the friend list and block list on web

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rohan requested review of this revision.Dec 8 2023, 5:59 AM
web/settings/relationship/user-list.react.js
29 ↗(On Diff #34418)

Same issue as here

Memoize values(userInfos)

You can probably use the fact that your hook takes an arbitrary array of UserInfos, and apply filterUser on userInfosArray before passing it into useUserSearchIndex. This will reduce the amount of computation needed inside of your hook

Address feedback

  • Call filterUser before constructing the search index to reduce the size of it
  • Remove the use of filterUser later on in the file
  • Update filterUser types to be UserInfo instead of AccountUserInfo (UserInfo has all the necessary info and Flow won't complain since I'm passing in UserInfos from userStore)
web/settings/relationship/user-list.react.js
42 ↗(On Diff #34545)

Changed this to userInfosArray.map(u => u.id) so instead of having all of the user IDs from the user store, it's now the user IDs from the filtered user infos

55 ↗(On Diff #34545)

Already called filterUser on the original userInfosArray that's in the search index now, so I removed this instance of it

inka added inline comments.
web/settings/relationship/user-list.react.js
48 ↗(On Diff #34545)

We should probably change this name then

This revision is now accepted and ready to land.Dec 13 2023, 3:42 AM