Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary request for anonymous cart and account cart #701

Closed
willopez opened this issue Jul 13, 2020 · 3 comments · Fixed by #705
Closed

Unnecessary request for anonymous cart and account cart #701

willopez opened this issue Jul 13, 2020 · 3 comments · Fixed by #705

Comments

@willopez
Copy link
Member

Type: minor

Describe the bug
On a clean installation, request for the anonymous cart and account cart will be executed even though, they are explicitly directed not to by the skip param. This is a known issue with Apollo Client, apollographql/react-apollo#3492. Revisit this after Apollo Client v3 is released and hopefully fixed.

To Reproduce
Steps to reproduce the behavior:

  1. Start with fresh installation
  2. Load product grid page
  3. Observe the following query being executed:
anonymousCartByCartIdQuery
with params: 
"cartId":null,
"cartToken":null

Expected behavior
This query should not execute on first executed until a user clicks on the "add to cart" button. See, https://github.com/reactioncommerce/example-storefront/blob/trunk/hooks/cart/useCart.js#L50 for details.

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome
  • Version 83
@janus-reith
Copy link
Collaborator

janus-reith commented Jul 14, 2020

As react-apollo is deprecated, here are some more recent related issues on apollo-client which is the library we're currerently experiencing that issue with:

apollographql/apollo-client#6572
apollographql/apollo-client#6507
apollographql/apollo-client#6190

v3.0.0 stable was released 4 hours ago, will check if that maybe contains a fix already.

@willopez
Copy link
Member Author

willopez commented Jul 14, 2020

@janus-reith sounds good and thank you for checking. And looks like this PR might be related to this issue: apollographql/apollo-client#6589

@janus-reith
Copy link
Collaborator

@willopez Yes I was thinking the same thing when I noticed it. Looking at the code, that itself probably won't solve it as the logic regarding onCompleted is happening after the query ran or was skipped accordingly, but at least it looks like they're currently working at that topic somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants