Page MenuHomePhabricator

[native, lib, web] [refactor] move text out of state
AbandonedPublic

Authored by tomek on May 16 2022, 2:24 PM.
Tags
None
Referenced Files
F1669154: D4060.id12826.diff
Sat, Apr 27, 7:57 AM
F1668192: D4060.id.diff
Fri, Apr 26, 5:12 PM
Unknown Object (File)
Thu, Apr 25, 2:03 AM
Unknown Object (File)
Wed, Apr 24, 5:00 PM
Unknown Object (File)
Mon, Apr 22, 9:43 PM
Unknown Object (File)
Mon, Apr 22, 12:41 AM
Unknown Object (File)
Fri, Apr 19, 6:42 PM
Unknown Object (File)
Fri, Apr 19, 6:42 PM

Details

Summary

to make search sidebars work with the SearchModal component it's state needs to be refactored to just the result set. This diff removes the text key/value and moves it into a React.useState which is later refactored in the following diff to get sidebar search data to work with SearchModal component.

Test Plan

Flow and eslint don't error. The sidebar search isn't functional in this diff but will be in the next diff.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

lib/hooks/search-sidebars.js
91 ↗(On Diff #12775)

After implementing <SearchModal /> in the following diff, we no longer need clearQuery and it's removed in the next diff.

tomek requested changes to this revision.May 19 2022, 1:11 AM
tomek added inline comments.
lib/hooks/search-sidebars.js
15

Why do we repeat text?

58

We don't usually start variable names with onSomething - this name is used for callbacks.

native/chat/sidebar-list-modal.react.js
59

I have some doubts about it. Currently, all the clients of the hook can set both text and search result. It would be a lot easier to reason about the state if only the text could be set and then the result would be updated by the hook. Do you think this can be achieved?

This revision now requires changes to proceed.May 19 2022, 1:11 AM
tomek abandoned this revision.
tomek edited reviewers, added: benschac; removed: tomek.

Later in the stack, it is mentioned that this is a part of https://linear.app/comm/issue/ENG-536/sidebar-list-modal-re-style - which is marked as done. If we decide to do something more about that issue, it would be probably easier to do it from scratch instead of figuring out how to make this stack solve the problem.