Abort fetch requests when component is removed #5677
maxpatiiuk
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When a component is removed before a network request is resolved, or an old request is replaced with a new one, the old request should be canceled. This would reduce wasted network bandwidth and reduce load on the back-end server.
Here is how to tell fetch to abort the request - https://developer.mozilla.org/en-US/docs/Web/API/AbortController/signal
Potentially, that could be integrated into the
useAsyncStatehook since that's where most network requests are made from on the front-endBeta Was this translation helpful? Give feedback.
All reactions