-
Notifications
You must be signed in to change notification settings - Fork 683
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
Create new Guest Cart when Checkout resets #917
Conversation
This pull request is automatically deployed with Now. |
Honestly I prefer this solution:
but I wanted to get a solution up quickly to discuss the options. |
I'm a little confused -- what was the actual source of the error? |
Oh, sorry - each cart has an id. After submitting an order, we wipe out that cart's id. When you attempt to add a new item, the error is that you can't because you don't have a cart. In the current code we catch that error, create a new cart, and then retry adding the item. But we don't do any of that in redux, which is where the new backstop error notification reducer is looking to see if the error got handled. It thinks that the error went unhandled, so it pops up the error notification. The solution I prefer is to create a new cart when the "continue shopping" button is clicked. |
I think that makes a lot of sense! |
* Create script for generating reference docs from source code * Fix develop script bug that makes the server reload continuously after a change * Clean up reference table template * Use new auto-generated content in topics * Update docblocks in source * Add clean command to scripts to prevent usage of stale content between develop runs * Run prettier * Adds unit tests to app reducer (#921) * Adds unit tests to app reducer * Updates tests to be less fragile * Add unit tests to cart reducer (#928) * Adds unit tests to catalog reducer (#931) * [DOCUMENTATION] cherry pick 3.0 doc updates (#992) * Fixed typo mistake (#939) * Fixed typo mistake (#969) * Scroll to top on Product mount (#832) * Create new guest cart when checkout resets (#917)
* Merge branch 'release/2.0' of /home/d.shmaliuk/pwa-studio with conflicts. * "Remove Item" in Minicart usability issue #661. Added loading element in MiniCart, after delete item. * "Remove Item" in Minicart usability issue #661. Added check for loadingElement object. * "Remove Item" in Minicart usability issue #661. Added check for loadingElement object. * "Remove Item" in Minicart usability issue #661. Added check for loadingElement object. * Adds unit tests to app reducer (#921) * Adds unit tests to app reducer * Updates tests to be less fragile * Add unit tests to cart reducer (#928) * Adds unit tests to catalog reducer (#931) * [DOCUMENTATION] cherry pick 3.0 doc updates (#992) * Fixed typo mistake (#939) * Fixed typo mistake (#969) * Scroll to top on Product mount (#832) * Create new guest cart when checkout resets (#917) * Purchase History unit tests and refactors (#891) * Simplifies and adds tests to purchaseHistory throughout the app * Simplifies and adds tests to purchaseHistory throughout the app * Adds snapshot test to PurchaseHistory Filter component * Mask specific product instead of entire cart during removeItem action * Remove unnecessary stuff. * Cleanup code and extra additions. * "Remove item" in minicart usability issue #661 Solved problem in file kebab.js * [FEATURE] "Remove item" in minicart usability issue Refactoring minicart.js
Description
This PR creates a new guest cart whenever the
checkout/reset
action is triggered.The
Continue Shopping
button triggers this action and thus creates a new guest cart on click. The user can add items to the newly created cart without error.Alternative Solutions
Move the Dispatch
The following code appears when
try
ing to add an item to the cart:We could move the
dispatch(actions.addItem.receive(error));
line to after the "no guest cart" retry logic so that the error only gets dispatched when there is truly an unhandled error.This "no guest cart" retry logic does appear in many places, however, so we'd likely want to make this change app-wide (in all the
asyncActions.js
files).Handle the Error in the Reducer
This has the effect of signaling the backstop error catching reducer that we're handling the error (by retrying) and that it shouldn't pop up a notification.
Related Issue
Closes #916 .
Motivation and Context
This change allows users to add items to their cart after a successful purchase.
How Has This Been Tested?
See the repro steps in #916.
Screenshots (if appropriate):
Proposed Labels for Change Type/Package
BUG
venia-concept
Checklist: