React: older fetch response overwrites newer search results
After quickly entering a new query, the list shows the answer for the previous text. Asynchronous requests can end in a different order than they were sent.
How to determine the source of the error
Save the start and end order of requests for subsequent query values.
Check that the Cleanup effect function cancels or ignores the previous request.
What to do step by step
1. Use the AbbotController and stop the previous fetch when changing the effect dependencies, or use the next request number.
2 . Update status only for the current query and handle the AbbotError separately from the actual API failure.
How to check the score
After fast character typing, the result corresponds to the last query, regardless of the order of the server response.
What to do
Do not solve the debounce race itself — reduces the number of requests but does not guarantee order.