fetch-multipart-graphql
fetch-multipart-graphql copied to clipboard
Return unsubscribe function in fetch implementation
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.