I do not know how to do when I need to batch mutation , Could you give me a small demo ?
Did you see this?
https://www.apollographql.com/docs/link/links/batch-http
Did you see this?
https://www.apollographql.com/docs/link/links/batch-http
Yes,I did, but I do not how to do when use ... Do you have a small example ?
If you use it instead of basic HTTP link, It will work out of the box. Assure that your backend is supports it.
Did you see this?
https://www.apollographql.com/docs/link/links/batch-http
If you use it instead of basic HTTP link, It will work out of the box. Assure that your backend is supports it.
The backend is supports it. But I still don't know how to use it in detail. I want to run the same mutation twice or thrice in a single HTTP request. Could you give me a specific example? Thanks
The only thing you really have to do is to change HttpLink to BatchHttpLink in you ApolloClient constructor. That's all. Do not forget to install and import corresponding apollo-link-batch-http package.
But if you are using Apollo Boost, then it's not possible to add another link, so you should migrate, following instructions here:
https://www.apollographql.com/docs/react/advanced/boost-migration
Everything will work automatically. For example, if you run multiple mutations in time window of 10 ms (that's default, you can change it by batchInterval option), than you'll see one request in Network tab. Note, that there's also number of queries limitation, configured through batchMax.
Thanks for helping out @OurMajesty!
@nixinxin0518 Issues here are reserved for Apollo Client bugs. You鈥檒l have a much better chance of getting this answered in Apollo鈥檚 Spectrum community or on Stack Overflow. Thanks!