slorber / react-async-hook

React hook to handle any async operation in React components, and prevent race conditions
https://sebastienlorber.com/handling-api-request-race-conditions-in-react
1.19k stars 45 forks source link

Cancel running fetch #101

Open Wolvenstone opened 1 year ago

Wolvenstone commented 1 year ago

Hi! I want to allow users to cancel running fetch requests in the UI. Even though the useAsyncAbortable sounds like the right place, it only handles aborting internally, and there seems to be no way to trigger that from the outside.

Am I missing something or is it not possible?

Wolvenstone commented 1 year ago

I added a PR to allow users to cancel running queries: https://github.com/slorber/react-async-hook/pull/102