prisma-labs/graphqlgen

Add the ability to abort request if it is in progress

avsokolov opened this issue · 0 comments

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);