简体   繁体   中英

How to subscribe to progress event of relay/ graphql mutation

I want to use mutations to upload files too, but I can't find any way to track the progress of the mutation (its upload, similar to the XMLHttpRequest progress event). Afaik relay is using fetch, but fetch doesn't provide any way to track progress ( https://github.com/whatwg/fetch/issues/21 ).

So, what's the best solution? Write a custom network layer which uses XMLHttpRequest? But then again, how to get a reference to the request object back to the caller of Store.commitUpdate ...?

In this case, you should use GraphQL subscriptions. Wanna an example? Please get it here: https://github.com/evolastech/todo-react

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM