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

Fix flash empty cart flashing when registering a user #3361

Merged
merged 2 commits into from
Dec 8, 2017

Conversation

iakhator
Copy link

@iakhator iakhator commented Nov 30, 2017

Resolve issue #3036

This PR fix empty cart showing up while registering new user, The reason for the empty cart showing up is that the cart.items is empty at the that window it tries to register the user. What I did was to create a helper method in checkout.js called cartCount where it checks if the cart.item exists and also check if the length is greater than 0.

Test

  • Place an order.
  • Checkout order.
  • Next step will show telling you to register.
  • Input details and register.
  • Notice that it doesn't show the empty cart page
  • It takes you to the next step.

Copy link
Collaborator

@brent-hoover brent-hoover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested. Verified fixed

@spencern spencern changed the base branch from master to release-1.6.1 December 8, 2017 22:39
@spencern spencern merged commit 211e5be into release-1.6.1 Dec 8, 2017
@spencern spencern deleted the itua-fix-issue-3036 branch December 8, 2017 22:40
@spencern spencern mentioned this pull request Dec 12, 2017
Akarshit pushed a commit that referenced this pull request Jan 7, 2018
Fix flash empty cart flashing when registering a user
},
cartCount() {
const cart = Cart.findOne();
if (cart.items && cart.items.length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a brief time when cart doesn't exist (this happens when a cart is transitioned to an order and another cart is being created for the user). In that brief time, an error is thrown in the browser console by this line.

This line will be better as:
if (cart && cart.items && cart.items.length > 0) {

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

Successfully merging this pull request may close these issues.

4 participants