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)
Mon, Apr 8, 1:35 AM
Unknown Object (File)
Mon, Apr 8, 1:35 AM
Unknown Object (File)
Mon, Apr 8, 1:35 AM
Unknown Object (File)
Mon, Apr 8, 1:34 AM
Unknown Object (File)
Mon, Apr 8, 1:15 AM
Unknown Object (File)
Sat, Apr 6, 5:04 PM
Unknown Object (File)
Wed, Mar 27, 10:00 PM
Unknown Object (File)
Mar 20 2024, 7:08 PM

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
Lint Not Applicable
Unit
Tests Not Applicable

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 ↗(On Diff #17161)

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 ↗(On Diff #17161)

Thanks for linking to that!

web/calendar/thread-picker.react.js
73–89 ↗(On Diff #17161)

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.