-
Notifications
You must be signed in to change notification settings - Fork 285
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: clear a user's cart after placing an order, and remove MiniCart popper from order completed page. #332
Conversation
src/pages/checkoutComplete.js
Outdated
|
||
refetchCart(); | ||
if (authStore.isAuthenticated) { |
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.
The contents of componentDidMount
that are used to update the cart cache should be in a function in the withCart
decorator, and that function should be called from componentDidMount
.
@@ -63,6 +63,7 @@ export default (Component) => ( | |||
// If success | |||
if (data && !error) { | |||
const { placeOrderWithStripeCardPayment: { orders, token } } = data; | |||
uiStore.closeCart(); |
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.
We should identify the reason cart is opening unintentionally and fix that, rather than forcing it closed for this specific instance.
…arterkit into fix-clear-cart-after-order
…-cart-after-order
@mikemurray this is ready for anther review, I added a loading when placing an order for a better UX. |
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.
Getting the following warning when I check out
Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
in CheckoutActions
…tarterkit into fix-clear-cart-after-order
@mikemurray error fixed and ready for another review. |
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'm also seeing a flash of the checkout actions during checkout.
When I submit the order, I see the "is loading" overlay, but for a split second, it disappears then re-appears, revealing the blank credit card form.
Is it possible to move this page loading component out of the checkout actions component? Maybe we can make it part of the layout, or something and trigger it globally. That may stop it from flashing when the CheckoutActions
does its render hiccup.
render() { | ||
const { classes } = this.props; | ||
const { delayIsDone } = this.state; | ||
|
||
return ( | ||
<div className={classes.wrapper}> | ||
{!!delayIsDone && this.renderSpinner()} | ||
{!!delayIsDone && this.renderMessage()} |
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.
Is the !!
necessary since delayIsDone
is already a boolean?
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.
it's necessary
Resolves #323
Impact: minor
Type: bugfix
Summary
The
MiniCart
popper would occasionally be rendered on the order completed page. This PR fixes that and clears the cart cache on the client instead of querying the server.Testing