-
Notifications
You must be signed in to change notification settings - Fork 679
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
[PWA-376] Cart page items show correct configurable options #2167
Conversation
|
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.
Add a comment and I'll approve.
@@ -42,7 +43,8 @@ export const cacheKeyFromType = object => { | |||
return object.url_key | |||
? `${MagentoGraphQLTypes.ProductInterface}:${object.url_key}` | |||
: defaultDataIdFromObject(object); | |||
|
|||
case MagentoGraphQLTypes.SelectedConfigurableOption: |
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.
I think a comment here explaining why we have to do this is warranted.
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.
Also looks like we are getting value_id
from the getCartDetails
query. I'm not sure that this is just some magical thing we have. We may want to make sure we add it to the product details query within the CartPage/
components
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.
Man, good catch! I had assumed Apollo automatically injected this key, but I was mistaken. The bug appeared to be fixed because we weren't caching any options, because object.value_id
was undefined
🤔
I've now fixed this up in a187f13 so it uses that field if available, and explicitly won't cache if its left out.
@@ -23,6 +23,7 @@ export const ProductListingFragment = gql` | |||
configurable_options { | |||
id | |||
option_label | |||
value_id |
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.
Silly enough - we now have two "required" fields. id
per validation although it's not actually guaranteed to be unique and value_id
because we use it for caching though you'd find no code within CartPage/
that uses it.
Description
Configurable Products listed in the MiniCart and new Cart page are showing different values for their configured properties (ex. Fashion Size, Fashion Color).
RCA:
configurable_options.id
is not unique based on selected values, so Apollo was not caching any other options after the first.Related Issue
Acceptance
Verification Stakeholders
Specification
Verification Steps
/cart
page and verify that options are correctly displayedScreenshots / Screen Captures (if appropriate)
Checklist