HomePhabricator
Diffusion Comm 5204fff125b1

[web] Remember resutls in search modal

Description

[web] Remember resutls in search modal

Summary:
issue: https://linear.app/comm/issue/ENG-4163/add-results-and-position-to-message-search-context
If the user searches for something, closes the modal and reopens it, we want to show them the results they have previously fetched. We only want the client to call the server, if the user presses the
"Search" button, or scrolls to the bottom.
This required a lot of changes, because we are no longer relying on useEffects to fetch messages. Instead we do it manually in onPressSearch and onScroll(-> possiblyLoadMoreMessages), and make
sure to not fetch the same results twice by using the loading ref.

Test Plan:
Checked that the results are remembered and displayed after reopening the modal, without refetching. Checked that if a user scrolls down or presses "search", new results are fetched.

Reviewers: kamil, kuba, michal

Reviewed By: michal

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D8301

Details

Provenance
InkaSokolowskaAuthored on Jun 22 2023, 6:58 AM
Reviewer
michal
Differential Revision
D8301: [web] Remember resutls in search modal
Parents
rCOMMf04198ddcb96: [web] Add to MessageSearchContext results related information
Branches
Unknown
Tags
Unknown