Skip to content

Cannot abort delayed retries #372

Open
@veloware

Description

@veloware

Describe the bug
When using retries, when the fetch is in the delay stage, i.e. delayed between retries, calling the abort function from the useFetch() hook has no effect.

⚠️ Make a Codesandbox ⚠️
Please do this to easily reproduce the bug.

To Reproduce
Steps to reproduce the behavior:

  • attach the abort() function to a button
  • make a fetch call that will cause a retry, with a reasonable delay for testing, say 5 secs.
  • after the first request has fullfilled and the fetch hook will delay for 5 secs before making the next request
  • during the delay, before the next request happens, click the button to call abort()
  • nothing happens, and the next request will eventually happen after the defined 5 secs.
  • click the button whilst the request is still in flight
  • it is finally aborted

Expected behavior
If delays are possible, it shouldn't matter when the abort is clicked, the subsequent requests should be aborted, not just an in flight request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions