HomePhabricator
Diffusion Comm 6c734b0bed90

[web] Fix message search results for old query appearing

Description

[web] Fix message search results for old query appearing

Summary:
If the user searched for "first query", and then before the results had the chance to appear, search for "second query", the results for "first query" would still be appended to the results array.
This diff fixes that by using an id for each server call, and after the results get fetched, the id of the server call is compared with the most recent id.

Test Plan: Checked that flow is not broken in web and native that both use useSearchMessages. checked that the above scenario doesn't happen anymore (I used network dev tools to ensure the messages didn't get fetched before the query was changed). Checked that it is still possible to fetch messages, and more messages for the same query.

Reviewers: kamil, kuba, michal

Reviewed By: michal

Subscribers: ashoat, tomek

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

Details

Provenance
InkaSokolowskaAuthored on Jun 27 2023, 6:29 AM
Reviewer
michal
Differential Revision
D8327: [web] Fix message search results for old query appearing
Parents
rCOMM5204fff125b1: [web] Remember resutls in search modal
Branches
Unknown
Tags
Unknown