You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please add the option to cancel the previous request, if it is in the Pending status, and in the meantime, another request has been sent (similar to switchMap in RxJS).
Problem:
Now, when I send the request, the text "Searching ..." is displayed, which is correct. However, when I enter a few more letters while I haven't received the response for my first request yet, a bug may appear. The results from the first request will be displayed while the second request will be in the Pending status and there is no information about it. "Searching ..." word is not visible on the Select element. This is especially problematic if you have to wait a long time for a response. Additionally, there may be a potential race condition of requests.
Example (race condition):
Example, when I type ABC the request with query param q=ABC, will be sent. Meanwhile, after we paused for a bit (more than the debounce time), we decide to type in another letter (the letter D) our app sends the request to the server with ABCD string. The results for string ABCD was cached so server replies very quickly. A few seconds later, however, the server finally replies with the response for the ABC string and overwriting results for string ABCD.
Diagram to illustrate the issue:
// A1: Request for ABC
// A2: Response for ABC
// B1: Request for ABCD
// B2: Response for ABCD
--A1----------A2-->
------B1--B2------>
The text was updated successfully, but these errors were encountered:
Please add the option to cancel the previous request, if it is in the Pending status, and in the meantime, another request has been sent (similar to
switchMap
inRxJS
).Problem:
Now, when I send the request, the text "Searching ..." is displayed, which is correct. However, when I enter a few more letters while I haven't received the response for my first request yet, a bug may appear. The results from the first request will be displayed while the second request will be in the Pending status and there is no information about it. "Searching ..." word is not visible on the Select element. This is especially problematic if you have to wait a long time for a response. Additionally, there may be a potential race condition of requests.
Example (race condition):
Example, when I type
ABC
the request with query paramq=ABC
, will be sent. Meanwhile, after we paused for a bit (more than the debounce time), we decide to type in another letter (the letterD
) our app sends the request to the server withABCD
string. The results for stringABCD
was cached so server replies very quickly. A few seconds later, however, the server finally replies with the response for theABC
string and overwriting results for stringABCD
.Diagram to illustrate the issue:
// A1: Request for
ABC
// A2: Response for
ABC
// B1: Request for
ABCD
// B2: Response for
ABCD
--
A1
----------A2
-->------
B1
--B2
------>The text was updated successfully, but these errors were encountered: