Skip to content

Abort pending request #969

@ghost

Description

The problem
There's no ability to cancel/abort a request that is pending and hasn't resolved yet

Use case

  • The user selected some parameters and the fetch began.
  • The user regretted his choice.
  • The user changed the parameters and another fetch began.
  • The second fetch resolved and data is displaying, the user is happy.
  • First fetch resolved, and because it was heavier, it took a longer time
  • The old unwanted data is being displayed, the user is sad.

Possible solutions
https://github.com/apollographql/apollo-feature-requests/issues/40#issuecomment-554561836
Works, but

  • You need to generate id yourself so that you will know what's the id of the current fetch
  • You need you to use methods without an abstraction, that it seems like, are not intended to be used by the end-user ( generateQueryId, fetchQuery, stopQuery etc )

apollographql/apollo-client#4150 (comment)
Works, but

  • You need to use a method, it seems like, not in the way it intended to be used
  • You need to promisify the subscribe and generally, work in a completely different way compared to simple query / mutation

Thoughts
It seems like the first solution is much more suitable, but a good abstraction should be implemented

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions