New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increased response time after too much cancelled request #3766
Comments
Hello! 👋 This issue is being automatically closed because it does not follow the issue template. Please read the issue template carefully and follow all of the instructions when opening a new issue. Thanks |
It seems something wrong with the place where you have defined the token. It will be redefined on each component render.
Currently, Axios has a conditional bug with cancelation token leakage (#3001) and the PR with fix is still waiting for the review (#3305), but it looks like this issue is not related to the bug. Or as an alternative, you can try to use an axios wrapper with a custom hook that supports auto-cancelation. (Live demo - click the fetch button repeatedly to see how the previous pending request was aborted):
|
I use live search. And i cancel previous request when new key pressed by user. But response time is too much when there is a lot of cancelled requests before last one. Ex: User pressed 10 times to keys. 9 request has been cancelled. The last one takes 3 seconds to response. If pressed 20 times to keys. 19 request has been cancelled. The last one takes 6 seconds to response. Less cancelled tokens before last request means faster response.
I use Laravel for api. Is there any solutions for this issue?
Expected behavior
Shouldnt effect response time for last request after too much cancelled previous request.
Environment
The text was updated successfully, but these errors were encountered: