prisma-labs / graphqlgen

⚙️ Generate type-safe resolvers based upon your GraphQL Schema
MIT License
818 stars 54 forks source link

Add the ability to abort request if it is in progress #497

Open avsokolov opened 4 years ago

avsokolov commented 4 years ago

Please, Please add the ability to abort requests.

Description

It can be implemented with AbortController. Something like

  const controller = new AbortController();
  const promise = getSdk(client, controller.signal).myQuery({...});
  setTimeout(() => consroller.abort(), 1000);
  promise.then(response => ...).catch(error => ...);

Or using rx.js Observables:

  const subsription = getSdk(client)
    .myQuery({...})
    .subsribe(response => ...);

  setTimeout(() => subsription.unsubscribe(), 1000);