-
Notifications
You must be signed in to change notification settings - Fork 682
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
fix: move cart creation out of trigger #2572
fix: move cart creation out of trigger #2572
Conversation
Signed-off-by: sirugh <[email protected]>
Signed-off-by: sirugh <[email protected]>
packages/venia-ui/lib/components/CartPage/GiftCards/giftCardQueries.js
Outdated
Show resolved
Hide resolved
|
Performance Test Results The following fails have been reported by WebpageTest. These numbers indicates a possible performance issue with the PR which requires further manual testing to validate. https://pr-2572.pwa-venia.com : LH Performance Expected 0.85 Actual 0.52, LH Best Practices Expected 1 Actual 0.92, WPT Cache Expected 90 Actual 83.333333333333 |
packages/venia-ui/lib/components/CartPage/GiftCards/giftCardQueries.js
Outdated
Show resolved
Hide resolved
query getCartDetails($cartId: String!) { | ||
cart(cart_id: $cartId) @connection(key: "Cart") { | ||
# The purpose of this query is to check that the user is authorized | ||
# to query on the current cart. Just fetch "id" to keep it small. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good explanation.
Signed-off-by: sirugh <[email protected]>
Co-authored-by: Revanth Kumar Annavarapu <[email protected]>
@@ -32,6 +32,7 @@ | |||
"@apollo/react-hooks": "~3.1.2", | |||
"@babel/runtime": "~7.4.2", | |||
"apollo-client": "~2.6.4", | |||
"graphql-tag": "~2.10.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I meant to bring this up when I mentioned that this was the first query in peregrine
. 💯
Description
For some reason the cart trigger owns cart creation. When the component mounts it invokes a "getCartDetails" action, which in turn checks for existence of a cart id and if it doesn't find one, calls the "createCart" action, which does another check for cart id and if it also doesn't find one, invokes a mutation to create a cart.
This could be simpler. We can move cart creation to the cart context provider.
Related Issue
Closes PWA-776.
Acceptance
Verification Stakeholders
Specification
Verification Steps
signin_token
to invalidate it (remove a character).Screenshots / Screen Captures (if appropriate)
Checklist