Hi folks,
we are working on ecommerce site using Shopify Storefront API and Apollo Client.
I have three operations:
mutation cartLinesAddWithoutCart- creates cart and adds the product, returns cart, and it’s idmutation cartLinesAddWithCart- adds another product to cart by id, returns cart and it’s idquery getCart- returns cart by id
When I run my cartLinesAddWithoutCart mutation, I get cart back with its id. I would expect that would automatically provide data for getCart query. But instead, it executes getCart over the network, instead of reading it from cache, which is far from ideal.
When I run my cartLinesAddWithCart mutation, everything works perfectly fine. When I get a response, cart updates immediately.
What might I be missing here?
Reproduction: Queries > Example app final (forked) - CodeSandbox
You can see that after hitting Create cart & add, we do get back the id and then the query takes place. If you uncomment fetchPolicy on line 190 it will not work at all.