fetch-multipart-graphql icon indicating copy to clipboard operation
fetch-multipart-graphql copied to clipboard

Return unsubscribe function in fetch implementation

Open danielrearden opened this issue 5 years ago • 0 comments

Right now, there is no way to unsubscribe. If the context changes (for example, we unmount the component that initialized the query), onNext will continue to be called with additional chunks until the request completes. I think it would make sense for the implementation to return an unsubscribe function that could then be used to cancel the network request. For browsers that support it, we can utilize an AbortController and just call abort inside that function.

danielrearden avatar Oct 31 '20 09:10 danielrearden