You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Hi guys, I have a big weird problem with emptyCart and removeItemsFromCart mutations. I'm using react as wordpress theme (so I'm working directly in wordpress folder) with create-react-wptheme. I copied -> pasted an older standalone react project with WP as backend inside of this react wordpress theme. It's basically the same thing ! THEN...
The problem is:
I add products into cart, everything work fine;
I update item quantity, it's okay;
If I have at least 2 products and I delete one of them, it works, item is correctly deleted, cart is updated;
Now, if I have only ONE item in cart or want to delete all items...then nothing happen;
I 'm using the @apollo/client library so when I use a mutation with useMutation, I also call refetch method from useQuery to refetch cart after some update. This "refetch" works when I add an item or update a existing item in cart like I said above. I don't understand at all why for removing last item or deleting all, refetch gives me back a non updated cart.
Expected behavior
These two mutations work fine in graphiql in admin dashboard (I mean when I query cart after calling one of these two, my cart is updated), so I expect the same in my app.
Screenshots
This is how I proceed. I call "refetch" in "onCompleted" callback provided by useMutation
As you can see in this screenshot, removeItemsFromCart mutation seems to work but refetch doesn't bring me back the correct updated cart. It's very strange.
This last screenshot is my apollo configuration
Desktop (please complete the following information):
OS: Ubuntu
Version 18
Plugin Versions
WooGraphQL Version: 0.5.1 …
WPGraphQL Version: 1.1.5 …
WordPress Version: 5.5.3
WooCommerce Version: 5.0.0
Additional context
The WEIRDEST thing is...Everything work perfectly in my standalone react project (the one I copied to use directly in wordpress folder).
The text was updated successfully, but these errors were encountered:
Describe the bug
Hi guys, I have a big weird problem with emptyCart and removeItemsFromCart mutations. I'm using react as wordpress theme (so I'm working directly in wordpress folder) with create-react-wptheme. I copied -> pasted an older standalone react project with WP as backend inside of this react wordpress theme. It's basically the same thing ! THEN...
The problem is:
I 'm using the @apollo/client library so when I use a mutation with useMutation, I also call refetch method from useQuery to refetch cart after some update. This "refetch" works when I add an item or update a existing item in cart like I said above. I don't understand at all why for removing last item or deleting all, refetch gives me back a non updated cart.
Expected behavior
These two mutations work fine in graphiql in admin dashboard (I mean when I query cart after calling one of these two, my cart is updated), so I expect the same in my app.
Screenshots
This is how I proceed. I call "refetch" in "onCompleted" callback provided by useMutation
As you can see in this screenshot, removeItemsFromCart mutation seems to work but refetch doesn't bring me back the correct updated cart. It's very strange.
This last screenshot is my apollo configuration
Desktop (please complete the following information):
Plugin Versions
Additional context
The WEIRDEST thing is...Everything work perfectly in my standalone react project (the one I copied to use directly in wordpress folder).
The text was updated successfully, but these errors were encountered: