Page MenuHomePhabricator

[web] implemented search feature for Thread Picker
ClosedPublic

Authored by ginsu on Sep 27 2022, 8:35 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 27, 9:13 PM
Unknown Object (File)
Sat, Oct 19, 2:38 AM
Unknown Object (File)
Sat, Oct 19, 2:38 AM
Unknown Object (File)
Sat, Oct 19, 2:38 AM
Unknown Object (File)
Sat, Oct 19, 2:38 AM
Unknown Object (File)
Sat, Oct 19, 2:33 AM
Unknown Object (File)
Sep 23 2024, 6:30 AM
Unknown Object (File)
Sep 20 2024, 2:43 AM

Details

Summary

Implemented the logic for the search feature for the ThreadPicker component. There is no UI for this diff due to Search breaking the app since the focusing/blurring of the picker component prevents input in Search


ENG-1847

Depends on D5230

Test Plan

To test the search feature, please add and modify the following blocks of code:

Screen Shot 2022-09-27 at 11.32.03 AM.png (444×952 px, 79 KB)

let searchBar = null;
if (this.props.searchIndex) {
  searchBar = (
    <Search
      searchText={this.state.searchText}
      onChangeText={this.onChangeSearchText}
      placeholder="Search chats"
    />
  );
}

Screen Shot 2022-09-27 at 11.27.40 AM.png (624×1 px, 96 KB)

You will also need to import the Search component from ../components/search.react at the top of the file

Once you have the Search component being returned you can add a new entry and test that the search feature is working as expected

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ginsu requested review of this revision.Sep 27 2022, 8:46 AM

made searchIndex a requried prop

web/calendar/thread-picker.react.js
73–89

This logic comes from the native ThreadList component

This revision is now accepted and ready to land.Sep 29 2022, 8:18 AM
web/calendar/thread-picker.react.js
73–89

Thanks for linking to that!

web/calendar/thread-picker.react.js
73–89

Ah yeah this is shitty. I understand now why you guys created ENG-1914.

Options here:

  1. Leave as-is (probably fine)
  2. Move whole thing to functional component (also probably fine)
  3. Extract searchText and searchResults state into ConnectedThreadPicker, pass getters/setters into class component. Then you can determine listData in ConnectedThreadPicker using React.useMemo

Separate note – if ENG-1914 had the right context of why we wanted to switch to a functional component (not that it needs to be "modern", but that we need to memoize something that depends on state) then I wouldn't have pushed back.

Anyways, feel free to reopen ENG-1914 if you guys prefer! Or leave as-is. I think any of the solutions above would be fine.