Page MenuHomePhabricator

[native] Use MessageSearchContent
AbandonedPublic

Authored by inka on May 10 2023, 3:56 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 19, 1:17 PM
Unknown Object (File)
Tue, Dec 3, 8:52 PM
Unknown Object (File)
Fri, Nov 29, 10:59 PM
Unknown Object (File)
Tue, Nov 26, 1:58 PM
Unknown Object (File)
Tue, Nov 26, 1:49 PM
Unknown Object (File)
Tue, Nov 26, 6:06 AM
Unknown Object (File)
Nov 22 2024, 9:12 PM
Unknown Object (File)
Nov 12 2024, 11:58 PM
Subscribers

Details

Summary
Test Plan

Checked that the messages are fetched and displayed correctly. Checked that the "End of results" and "No results..." messages display correctly. Checked the case when
the first fetch returns all results as well as the case when the user needs to scroll to fetch more messages a couple of times. Checked that if the query is cleared "Your search results will appear here!" message is displayed.
Checked that if the query is not cleared between the searches everything works - only the results of the second query are displayed.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

inka requested review of this revision.May 10 2023, 4:17 AM
native/search/message-search.react.js
67 ↗(On Diff #26332)

What's the point of this wrapping View?

Probably not worth doing now, but I think it would be more clear to the reveiwer if you had put D7774 before D7773. Then you could squash this into D7773

Probably not worth doing now, but I think it would be more clear to the reveiwer if you had put D7774 before D7773. Then you could squash this into D7773

In D7774 I needed to have the MessageSearch route, to be able to render MessageResult. I could have split that diff, but I thought it didn't make much difference which one I split

Can you explain more about the distinction between MessageSearch and MessageSearchContent? Wondering why they're separated, and what each is responsible for

Can you explain more about the distinction between MessageSearch and MessageSearchContent? Wondering why they're separated, and what each is responsible for

They are separated so that when there is no query, all of the code for fetching and parsing search results doesn't get called (since hooks cannot be called conditionally). Additionally MessageSearch takes care of cleaning up the results and/or the query when user does something like navigates back or changes the query. Search content is just meant to fetch and display things, not handle interactions.

ashoat requested changes to this revision.May 16 2023, 6:04 AM

since hooks cannot be called conditionally

To be honest, I think calling the search functionality from a hook instead of from a callback is the wrong approach. It leads to issues like ENG-3896, since data being recalculated can lead to the search being performed again. More details in my comment on D7774, but I suspect after applying my feedback there it might make sense to merge MessageSearch and MessageSearchContent.

This revision now requires changes to proceed.May 16 2023, 6:04 AM

I amended D7774 and D7771 to address this review. I still have to call the logic that is not being used if the query is empty, because there are many other hooks in that code.
This diff will need to be dropped if those changes are accepted.